From 16ea8dec8c195d3ea2aa1d4266167b9197792cef Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 14 Nov 2024 11:30:10 +0530 Subject: [PATCH] feat(spec): updated the sdk as per the api spec released on 2024-11-13 Signed-off-by: Ujjwal Kumar --- README.md | 8 +- common/version.go | 2 +- go.mod | 6 +- go.sum | 19 +- vpcv1/vpc_v1.go | 30360 ++++++++++++-------- vpcv1/vpc_v1_examples_test.go | 673 +- vpcv1/vpc_v1_test.go | 47990 +++++++++++++++++++------------- 7 files changed, 48546 insertions(+), 30512 deletions(-) diff --git a/README.md b/README.md index a8ff5c9..220c6af 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/IBM/vpc-go-sdk) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) -# IBM Cloud VPC Go SDK Version 0.61.0 +# IBM Cloud VPC Go SDK Version 0.62.0 Go client library to interact with the various [IBM Cloud VPC Services APIs](https://cloud.ibm.com/apidocs?category=vpc). **Note:** Given the current version of all VPC SDKs across supported languages and the current VPC API specification, we retracted the vpc-go-sdk version 1.x to version v0.6.0, which had the same features as v1.0.1. -Consider using v0.61.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` on go 1.14 and lower as you will not get the latest release. +Consider using v0.62.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` on go 1.14 and lower as you will not get the latest release. This SDK uses [Semantic Versioning](https://semver.org), and as such there may be backward-incompatible changes for any new `0.y.z` version. ## Table of Contents @@ -64,7 +64,7 @@ Use this command to download and install the VPC Go SDK service to allow your Go use it: ``` -go get github.com/IBM/vpc-go-sdk@v0.61.0 +go get github.com/IBM/vpc-go-sdk@v0.62.0 ``` @@ -90,7 +90,7 @@ to your `Gopkg.toml` file. Here is an example: ``` [[constraint]] name = "github.com/IBM/vpc-go-sdk/" - version = "0.61.0" + version = "0.62.0" ``` Then run `dep ensure`. diff --git a/common/version.go b/common/version.go index 4068574..f6dc424 100644 --- a/common/version.go +++ b/common/version.go @@ -1,4 +1,4 @@ package common // Version of the SDK -const Version = "0.61.0" +const Version = "0.62.0" diff --git a/go.mod b/go.mod index 0bcb10e..c9c716a 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,11 @@ module github.com/IBM/vpc-go-sdk -go 1.20 +go 1.21 + +toolchain go1.22.2 require ( - github.com/IBM/go-sdk-core/v5 v5.17.4 + github.com/IBM/go-sdk-core/v5 v5.18.1 github.com/go-openapi/strfmt v0.22.1 github.com/google/uuid v1.6.0 github.com/onsi/ginkgo v1.16.5 diff --git a/go.sum b/go.sum index f3f9d05..75adfc5 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,12 @@ -github.com/IBM/go-sdk-core/v5 v5.17.4 h1:VGb9+mRrnS2HpHZFM5hy4J6ppIWnwNrw0G+tLSgcJLc= -github.com/IBM/go-sdk-core/v5 v5.17.4/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns= +github.com/IBM/go-sdk-core/v5 v5.18.1 h1:wdftQO8xejECTWTKF3FGXyW0McKxxDAopH7MKwA187c= +github.com/IBM/go-sdk-core/v5 v5.18.1/go.mod h1:3ywpylZ41WhWPusqtpJZWopYlt2brebcphV7mA2JncU= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= 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.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -13,11 +14,13 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 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/strfmt v0.22.1 h1:5Ky8cybT4576C6Ffc+8gYji/wRXCo6Ozm8RaWjPI6jc= github.com/go-openapi/strfmt v0.22.1/go.mod h1:OfVoytIXJasDkkGvkb1Cceb3BPyMOwk1FgmyyEw7NYg= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= 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= @@ -26,6 +29,7 @@ github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -34,28 +38,35 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 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/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= 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 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/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= 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.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= 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/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -66,6 +77,7 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 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/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= @@ -115,6 +127,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -126,8 +139,10 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= diff --git a/vpcv1/vpc_v1.go b/vpcv1/vpc_v1.go index ebe2167..76ddbcc 100644 --- a/vpcv1/vpc_v1.go +++ b/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.92.2-3f2a0533-20240712-183330 + * IBM OpenAPI SDK Code Generator Version: 3.96.1-5136e54a-20241108-203028 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -38,7 +38,7 @@ import ( // VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual // server instances, along with subnets, volumes, load balancers, and more. // -// API Version: 2024-10-17 +// API Version: 2024-11-12 type VpcV1 struct { Service *core.BaseService @@ -47,7 +47,7 @@ type VpcV1 struct { Generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-04-30` - // and `2024-10-17`. + // and `2024-11-14`. Version *string } @@ -68,8 +68,8 @@ type VpcV1Options struct { Generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-04-30` - // and `2024-10-17`. Version *string + // and `2024-11-14`. } // NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. @@ -133,7 +133,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2024-10-15") + options.Version = core.StringPtr("2024-11-12") } service = &VpcV1{ Service: baseService, @@ -5297,6 +5297,9 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List if listKeysOptions.Limit != nil { builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.Limit)) } + if listKeysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listKeysOptions.ResourceGroupID)) + } request, err := builder.Build() if err != nil { @@ -6168,6 +6171,15 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt if listInstancesOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) } + if listInstancesOptions.ClusterNetworkID != nil { + builder.AddQuery("cluster_network.id", fmt.Sprint(*listInstancesOptions.ClusterNetworkID)) + } + if listInstancesOptions.ClusterNetworkCRN != nil { + builder.AddQuery("cluster_network.crn", fmt.Sprint(*listInstancesOptions.ClusterNetworkCRN)) + } + if listInstancesOptions.ClusterNetworkName != nil { + builder.AddQuery("cluster_network.name", fmt.Sprint(*listInstancesOptions.ClusterNetworkName)) + } if listInstancesOptions.DedicatedHostID != nil { builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) } @@ -6691,6 +6703,409 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns return } +// ListInstanceClusterNetworkAttachments : List cluster network attachments on an instance +// This request lists cluster network attachments on an instance. A cluster network attachment represents a device on +// the instance to which a cluster network interface is attached. +func (vpc *VpcV1) ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptions *ListInstanceClusterNetworkAttachmentsOptions) (result *InstanceClusterNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceClusterNetworkAttachmentsWithContext(context.Background(), listInstanceClusterNetworkAttachmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListInstanceClusterNetworkAttachmentsWithContext is an alternate form of the ListInstanceClusterNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceClusterNetworkAttachmentsWithContext(ctx context.Context, listInstanceClusterNetworkAttachmentsOptions *ListInstanceClusterNetworkAttachmentsOptions) (result *InstanceClusterNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceClusterNetworkAttachmentsOptions, "listInstanceClusterNetworkAttachmentsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listInstanceClusterNetworkAttachmentsOptions, "listInstanceClusterNetworkAttachmentsOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceClusterNetworkAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/cluster_network_attachments`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listInstanceClusterNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceClusterNetworkAttachments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listInstanceClusterNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceClusterNetworkAttachmentsOptions.Start)) + } + if listInstanceClusterNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceClusterNetworkAttachmentsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_instance_cluster_network_attachments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceClusterNetworkAttachmentCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// CreateClusterNetworkAttachment : Create a cluster network attachment +// This request creates a cluster network attachment from an instance cluster network attachment prototype object. A +// cluster network attachment will attach the instance to a cluster network. The cluster network attachment prototype +// must specify a cluster network interface identity or a cluster network interface prototype. +// +// The instance must be in a `stopped` or `stopping` state to create an instance cluster network attachment. +func (vpc *VpcV1) CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptions *CreateClusterNetworkAttachmentOptions) (result *InstanceClusterNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateClusterNetworkAttachmentWithContext(context.Background(), createClusterNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateClusterNetworkAttachmentWithContext is an alternate form of the CreateClusterNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateClusterNetworkAttachmentWithContext(ctx context.Context, createClusterNetworkAttachmentOptions *CreateClusterNetworkAttachmentOptions) (result *InstanceClusterNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createClusterNetworkAttachmentOptions, "createClusterNetworkAttachmentOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createClusterNetworkAttachmentOptions, "createClusterNetworkAttachmentOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createClusterNetworkAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/cluster_network_attachments`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createClusterNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + body := make(map[string]interface{}) + if createClusterNetworkAttachmentOptions.ClusterNetworkInterface != nil { + body["cluster_network_interface"] = createClusterNetworkAttachmentOptions.ClusterNetworkInterface + } + if createClusterNetworkAttachmentOptions.Before != nil { + body["before"] = createClusterNetworkAttachmentOptions.Before + } + if createClusterNetworkAttachmentOptions.Name != nil { + body["name"] = createClusterNetworkAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "create_cluster_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceClusterNetworkAttachment) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeleteInstanceClusterNetworkAttachment : Delete an instance cluster network attachment +// This request deletes an instance cluster network attachment. The instance must be in a +// `stopped` or `stopping` state to delete an instance cluster network attachment. +// +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptions *DeleteInstanceClusterNetworkAttachmentOptions) (result *InstanceClusterNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteInstanceClusterNetworkAttachmentWithContext(context.Background(), deleteInstanceClusterNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteInstanceClusterNetworkAttachmentWithContext is an alternate form of the DeleteInstanceClusterNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceClusterNetworkAttachmentWithContext(ctx context.Context, deleteInstanceClusterNetworkAttachmentOptions *DeleteInstanceClusterNetworkAttachmentOptions) (result *InstanceClusterNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceClusterNetworkAttachmentOptions, "deleteInstanceClusterNetworkAttachmentOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteInstanceClusterNetworkAttachmentOptions, "deleteInstanceClusterNetworkAttachmentOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceClusterNetworkAttachmentOptions.InstanceID, + "id": *deleteInstanceClusterNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/cluster_network_attachments/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteInstanceClusterNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceClusterNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "delete_instance_cluster_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceClusterNetworkAttachment) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetInstanceClusterNetworkAttachment : Retrieve an instance cluster network attachment +// This request retrieves a single instance cluster network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptions *GetInstanceClusterNetworkAttachmentOptions) (result *InstanceClusterNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceClusterNetworkAttachmentWithContext(context.Background(), getInstanceClusterNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetInstanceClusterNetworkAttachmentWithContext is an alternate form of the GetInstanceClusterNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceClusterNetworkAttachmentWithContext(ctx context.Context, getInstanceClusterNetworkAttachmentOptions *GetInstanceClusterNetworkAttachmentOptions) (result *InstanceClusterNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceClusterNetworkAttachmentOptions, "getInstanceClusterNetworkAttachmentOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getInstanceClusterNetworkAttachmentOptions, "getInstanceClusterNetworkAttachmentOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceClusterNetworkAttachmentOptions.InstanceID, + "id": *getInstanceClusterNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/cluster_network_attachments/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getInstanceClusterNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceClusterNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "get_instance_cluster_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceClusterNetworkAttachment) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// UpdateInstanceClusterNetworkAttachment : Update an instance cluster network attachment +// This request updates an instance cluster network attachment with the information provided in an instance network +// interface patch object. The instance cluster network attachment patch object is structured in the same way as a +// retrieved instance cluster network attachment and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptions *UpdateInstanceClusterNetworkAttachmentOptions) (result *InstanceClusterNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceClusterNetworkAttachmentWithContext(context.Background(), updateInstanceClusterNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateInstanceClusterNetworkAttachmentWithContext is an alternate form of the UpdateInstanceClusterNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceClusterNetworkAttachmentWithContext(ctx context.Context, updateInstanceClusterNetworkAttachmentOptions *UpdateInstanceClusterNetworkAttachmentOptions) (result *InstanceClusterNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceClusterNetworkAttachmentOptions, "updateInstanceClusterNetworkAttachmentOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateInstanceClusterNetworkAttachmentOptions, "updateInstanceClusterNetworkAttachmentOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceClusterNetworkAttachmentOptions.InstanceID, + "id": *updateInstanceClusterNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/cluster_network_attachments/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updateInstanceClusterNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceClusterNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceClusterNetworkAttachmentOptions.InstanceClusterNetworkAttachmentPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "update_instance_cluster_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceClusterNetworkAttachment) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + // CreateInstanceConsoleAccessToken : Create a console access token for an instance // This request creates a new single-use console access token for an instance. All console configuration is provided at // token create time, and the token is subsequently used in the `access_token` query parameter for the WebSocket @@ -20390,19 +20805,18 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a return } -// ListPublicGateways : List public gateways -// This request lists public gateways in the region. A public gateway is a virtual network device associated with a VPC, -// which allows access to the Internet. A public gateway resides in a zone and can be connected to subnets in the same -// zone only. -func (vpc *VpcV1) ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) +// ListClusterNetworkProfiles : List cluster network profiles +// This request lists cluster network profiles available in the region. A cluster network profile specifies the +// performance characteristics and capabilities for a cluster network. +func (vpc *VpcV1) ListClusterNetworkProfiles(listClusterNetworkProfilesOptions *ListClusterNetworkProfilesOptions) (result *ClusterNetworkProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListClusterNetworkProfilesWithContext(context.Background(), listClusterNetworkProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPublicGatewaysWithContext is an alternate form of the ListPublicGateways method which supports a Context parameter -func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPublicGatewaysOptions, "listPublicGatewaysOptions") +// ListClusterNetworkProfilesWithContext is an alternate form of the ListClusterNetworkProfiles method which supports a Context parameter +func (vpc *VpcV1) ListClusterNetworkProfilesWithContext(ctx context.Context, listClusterNetworkProfilesOptions *ListClusterNetworkProfilesOptions) (result *ClusterNetworkProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listClusterNetworkProfilesOptions, "listClusterNetworkProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -20411,17 +20825,17 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_network/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPublicGatewaysOptions.Headers { + for headerName, headerValue := range listClusterNetworkProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20429,14 +20843,11 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listPublicGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) - } - if listPublicGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) + if listClusterNetworkProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworkProfilesOptions.Start)) } - if listPublicGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) + if listClusterNetworkProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkProfilesOptions.Limit)) } request, err := builder.Build() @@ -20448,12 +20859,12 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_public_gateways", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_cluster_network_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20464,77 +20875,142 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG return } -// CreatePublicGateway : Create a public gateway -// This request creates a new public gateway from a public gateway prototype object. For this to succeed, the VPC must -// not already have a public gateway in the specified zone. -// -// If a floating IP is provided, it must be unbound. If a floating IP is not provided, one will be created and bound to -// the public gateway. Once a public gateway has been created, its floating IP cannot be unbound. A public gateway must -// be explicitly attached to each subnet it will provide connectivity for. -func (vpc *VpcV1) CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) +// GetClusterNetworkProfile : Retrieve a cluster network profile +// This request retrieves a single cluster network profile specified by the name in the URL. +func (vpc *VpcV1) GetClusterNetworkProfile(getClusterNetworkProfileOptions *GetClusterNetworkProfileOptions) (result *ClusterNetworkProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetClusterNetworkProfileWithContext(context.Background(), getClusterNetworkProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreatePublicGatewayWithContext is an alternate form of the CreatePublicGateway method which supports a Context parameter -func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPublicGatewayOptions, "createPublicGatewayOptions cannot be nil") +// GetClusterNetworkProfileWithContext is an alternate form of the GetClusterNetworkProfile method which supports a Context parameter +func (vpc *VpcV1) GetClusterNetworkProfileWithContext(ctx context.Context, getClusterNetworkProfileOptions *GetClusterNetworkProfileOptions) (result *ClusterNetworkProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getClusterNetworkProfileOptions, "getClusterNetworkProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") + err = core.ValidateStruct(getClusterNetworkProfileOptions, "getClusterNetworkProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "name": *getClusterNetworkProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_network/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createPublicGatewayOptions.Headers { + for headerName, headerValue := range getClusterNetworkProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createPublicGatewayOptions.VPC != nil { - body["vpc"] = createPublicGatewayOptions.VPC - } - if createPublicGatewayOptions.Zone != nil { - body["zone"] = createPublicGatewayOptions.Zone + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if createPublicGatewayOptions.FloatingIP != nil { - body["floating_ip"] = createPublicGatewayOptions.FloatingIP + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "get_cluster_network_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } - if createPublicGatewayOptions.Name != nil { - body["name"] = createPublicGatewayOptions.Name + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkProfile) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result } - if createPublicGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createPublicGatewayOptions.ResourceGroup + + return +} + +// ListClusterNetworks : List cluster networks +// This request lists [cluster networks](https://cloud.ibm.com/docs/vpc?topic=vpc-about-cluster-network) in the region. +// A cluster network is a grouping of resources in a separate networking space for high performance computing and +// networking. +func (vpc *VpcV1) ListClusterNetworks(listClusterNetworksOptions *ListClusterNetworksOptions) (result *ClusterNetworkCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListClusterNetworksWithContext(context.Background(), listClusterNetworksOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListClusterNetworksWithContext is an alternate form of the ListClusterNetworks method which supports a Context parameter +func (vpc *VpcV1) ListClusterNetworksWithContext(ctx context.Context, listClusterNetworksOptions *ListClusterNetworksOptions) (result *ClusterNetworkCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listClusterNetworksOptions, "listClusterNetworksOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } - _, err = builder.SetBodyContentJSON(body) + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks`, nil) if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } + for headerName, headerValue := range listClusterNetworksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listClusterNetworksOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworksOptions.Start)) + } + if listClusterNetworksOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworksOptions.Limit)) + } + if listClusterNetworksOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listClusterNetworksOptions.ResourceGroupID)) + } + if listClusterNetworksOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listClusterNetworksOptions.Name)) + } + if listClusterNetworksOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listClusterNetworksOptions.Sort)) + } + if listClusterNetworksOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listClusterNetworksOptions.VPCID)) + } + if listClusterNetworksOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listClusterNetworksOptions.VPCCRN)) + } + if listClusterNetworksOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listClusterNetworksOptions.VPCName)) + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -20544,12 +21020,12 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_cluster_networks", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20560,109 +21036,146 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl return } -// DeletePublicGateway : Delete a public gateway -// This request deletes a public gateway. This operation cannot be reversed. For this request to succeed, the public -// gateway must not be attached to any subnets. The public gateway's floating IP will be automatically unbound. If the -// floating IP was created when the public gateway was created, it will be deleted. -func (vpc *VpcV1) DeletePublicGateway(deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) +// CreateClusterNetwork : Create a cluster network +// This request creates a new cluster network from a cluster network prototype object. The prototype object is +// structured in the same way as a retrieved cluster network, and contains the information necessary to create the new +// cluster network. +func (vpc *VpcV1) CreateClusterNetwork(createClusterNetworkOptions *CreateClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateClusterNetworkWithContext(context.Background(), createClusterNetworkOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeletePublicGatewayWithContext is an alternate form of the DeletePublicGateway method which supports a Context parameter -func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePublicGatewayOptions, "deletePublicGatewayOptions cannot be nil") +// CreateClusterNetworkWithContext is an alternate form of the CreateClusterNetwork method which supports a Context parameter +func (vpc *VpcV1) CreateClusterNetworkWithContext(ctx context.Context, createClusterNetworkOptions *CreateClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createClusterNetworkOptions, "createClusterNetworkOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") + err = core.ValidateStruct(createClusterNetworkOptions, "createClusterNetworkOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *deletePublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deletePublicGatewayOptions.Headers { + for headerName, headerValue := range createClusterNetworkOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetwork") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + body := make(map[string]interface{}) + if createClusterNetworkOptions.Profile != nil { + body["profile"] = createClusterNetworkOptions.Profile + } + if createClusterNetworkOptions.VPC != nil { + body["vpc"] = createClusterNetworkOptions.VPC + } + if createClusterNetworkOptions.Zone != nil { + body["zone"] = createClusterNetworkOptions.Zone + } + if createClusterNetworkOptions.Name != nil { + body["name"] = createClusterNetworkOptions.Name + } + if createClusterNetworkOptions.ResourceGroup != nil { + body["resource_group"] = createClusterNetworkOptions.ResourceGroup + } + if createClusterNetworkOptions.SubnetPrefixes != nil { + body["subnet_prefixes"] = createClusterNetworkOptions.SubnetPrefixes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_cluster_network", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetPublicGateway : Retrieve a public gateway -// This request retrieves a single public gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) +// ListClusterNetworkInterfaces : List cluster network interfaces +// This request lists cluster network interfaces in the region. A cluster network interface is a logical abstraction of +// a cluster network interface in a subnet, and may be attached to a target resource. +// +// The cluster network interfaces will be sorted by their `created_at` property values, with newest cluster network +// interfaces first. Cluster network interfaces with identical +// `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptions *ListClusterNetworkInterfacesOptions) (result *ClusterNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListClusterNetworkInterfacesWithContext(context.Background(), listClusterNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetPublicGatewayWithContext is an alternate form of the GetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPublicGatewayOptions, "getPublicGatewayOptions cannot be nil") +// ListClusterNetworkInterfacesWithContext is an alternate form of the ListClusterNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListClusterNetworkInterfacesWithContext(ctx context.Context, listClusterNetworkInterfacesOptions *ListClusterNetworkInterfacesOptions) (result *ClusterNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listClusterNetworkInterfacesOptions, "listClusterNetworkInterfacesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") + err = core.ValidateStruct(listClusterNetworkInterfacesOptions, "listClusterNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getPublicGatewayOptions.ID, + "cluster_network_id": *listClusterNetworkInterfacesOptions.ClusterNetworkID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPublicGatewayOptions.Headers { + for headerName, headerValue := range listClusterNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20670,6 +21183,18 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listClusterNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworkInterfacesOptions.Start)) + } + if listClusterNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkInterfacesOptions.Limit)) + } + if listClusterNetworkInterfacesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listClusterNetworkInterfacesOptions.Name)) + } + if listClusterNetworkInterfacesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listClusterNetworkInterfacesOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -20680,12 +21205,12 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_cluster_network_interfaces", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterfaceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20696,55 +21221,67 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate return } -// UpdatePublicGateway : Update a public gateway -// This request updates a public gateway's name. -func (vpc *VpcV1) UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) +// CreateClusterNetworkInterface : Create a cluster network interface +// This request creates a new cluster network interface from a cluster network interface prototype object. The prototype +// object is structured in the same way as a retrieved cluster network interface, and contains the information necessary +// to create the new cluster network interface. +func (vpc *VpcV1) CreateClusterNetworkInterface(createClusterNetworkInterfaceOptions *CreateClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateClusterNetworkInterfaceWithContext(context.Background(), createClusterNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdatePublicGatewayWithContext is an alternate form of the UpdatePublicGateway method which supports a Context parameter -func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePublicGatewayOptions, "updatePublicGatewayOptions cannot be nil") +// CreateClusterNetworkInterfaceWithContext is an alternate form of the CreateClusterNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateClusterNetworkInterfaceWithContext(ctx context.Context, createClusterNetworkInterfaceOptions *CreateClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createClusterNetworkInterfaceOptions, "createClusterNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") + err = core.ValidateStruct(createClusterNetworkInterfaceOptions, "createClusterNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updatePublicGatewayOptions.ID, + "cluster_network_id": *createClusterNetworkInterfaceOptions.ClusterNetworkID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updatePublicGatewayOptions.Headers { + for headerName, headerValue := range createClusterNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) + body := make(map[string]interface{}) + if createClusterNetworkInterfaceOptions.Name != nil { + body["name"] = createClusterNetworkInterfaceOptions.Name + } + if createClusterNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createClusterNetworkInterfaceOptions.PrimaryIP + } + if createClusterNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createClusterNetworkInterfaceOptions.Subnet + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -20759,12 +21296,12 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_cluster_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20775,68 +21312,58 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl return } -// ListFloatingIps : List floating IPs -// This request lists floating IPs in the region. Floating IPs allow inbound and outbound traffic from the Internet to -// an instance. -func (vpc *VpcV1) ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) +// DeleteClusterNetworkInterface : Delete a cluster network interface +// This request deletes a cluster network interface. This operation cannot be reversed. For this request to succeed, +// the cluster network interface must not be required by another resource, such as a cluster network attachment for a +// virtual server instance. +func (vpc *VpcV1) DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptions *DeleteClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteClusterNetworkInterfaceWithContext(context.Background(), deleteClusterNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListFloatingIpsWithContext is an alternate form of the ListFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listFloatingIpsOptions, "listFloatingIpsOptions") +// DeleteClusterNetworkInterfaceWithContext is an alternate form of the DeleteClusterNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteClusterNetworkInterfaceWithContext(ctx context.Context, deleteClusterNetworkInterfaceOptions *DeleteClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteClusterNetworkInterfaceOptions, "deleteClusterNetworkInterfaceOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteClusterNetworkInterfaceOptions, "deleteClusterNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "cluster_network_id": *deleteClusterNetworkInterfaceOptions.ClusterNetworkID, + "id": *deleteClusterNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listFloatingIpsOptions.Headers { + for headerName, headerValue := range deleteClusterNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if deleteClusterNetworkInterfaceOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkInterfaceOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listFloatingIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) - } - if listFloatingIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listFloatingIpsOptions.Limit)) - } - if listFloatingIpsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listFloatingIpsOptions.ResourceGroupID)) - } - if listFloatingIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort)) - } - if listFloatingIpsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listFloatingIpsOptions.TargetID)) - } - if listFloatingIpsOptions.TargetCRN != nil { - builder.AddQuery("target.crn", fmt.Sprint(*listFloatingIpsOptions.TargetCRN)) - } - if listFloatingIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName)) - } - if listFloatingIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType)) - } request, err := builder.Build() if err != nil { @@ -20847,12 +21374,12 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_floating_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_cluster_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20863,56 +21390,54 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp return } -// CreateFloatingIP : Reserve a floating IP -// This request reserves a new floating IP. -func (vpc *VpcV1) CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) +// GetClusterNetworkInterface : Retrieve a cluster network interface +// This request retrieves a single cluster network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetClusterNetworkInterface(getClusterNetworkInterfaceOptions *GetClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetClusterNetworkInterfaceWithContext(context.Background(), getClusterNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateFloatingIPWithContext is an alternate form of the CreateFloatingIP method which supports a Context parameter -func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createFloatingIPOptions, "createFloatingIPOptions cannot be nil") +// GetClusterNetworkInterfaceWithContext is an alternate form of the GetClusterNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetClusterNetworkInterfaceWithContext(ctx context.Context, getClusterNetworkInterfaceOptions *GetClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getClusterNetworkInterfaceOptions, "getClusterNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") + err = core.ValidateStruct(getClusterNetworkInterfaceOptions, "getClusterNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "cluster_network_id": *getClusterNetworkInterfaceOptions.ClusterNetworkID, + "id": *getClusterNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createFloatingIPOptions.Headers { + for headerName, headerValue := range getClusterNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -20922,12 +21447,12 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_cluster_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20938,108 +21463,131 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin return } -// DeleteFloatingIP : Delete a floating IP -// This request disassociates (if associated) and releases a floating IP. This operation cannot be reversed. For this -// request to succeed, the floating IP must not be required by another resource, such as a public gateway. -func (vpc *VpcV1) DeleteFloatingIP(deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) +// UpdateClusterNetworkInterface : Update a cluster network interface +// This request updates a cluster network interface with the information provided in a cluster network interface patch +// object. The patch object is structured in the same way as a retrieved cluster network interface and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptions *UpdateClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateClusterNetworkInterfaceWithContext(context.Background(), updateClusterNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteFloatingIPWithContext is an alternate form of the DeleteFloatingIP method which supports a Context parameter -func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteFloatingIPOptions, "deleteFloatingIPOptions cannot be nil") +// UpdateClusterNetworkInterfaceWithContext is an alternate form of the UpdateClusterNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateClusterNetworkInterfaceWithContext(ctx context.Context, updateClusterNetworkInterfaceOptions *UpdateClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateClusterNetworkInterfaceOptions, "updateClusterNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") + err = core.ValidateStruct(updateClusterNetworkInterfaceOptions, "updateClusterNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteFloatingIPOptions.ID, + "cluster_network_id": *updateClusterNetworkInterfaceOptions.ClusterNetworkID, + "id": *updateClusterNetworkInterfaceOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteFloatingIPOptions.Headers { + for headerName, headerValue := range updateClusterNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateClusterNetworkInterfaceOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateClusterNetworkInterfaceOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateClusterNetworkInterfaceOptions.ClusterNetworkInterfacePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_cluster_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetFloatingIP : Retrieve a floating IP -// This request retrieves a single floating IP specified by the identifier in the URL. -func (vpc *VpcV1) GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) +// ListClusterNetworkSubnets : List cluster network subnets +// This request lists cluster network subnets in the cluster network. A cluster network subnet provides network routing +// between other cluster network subnets within a cluster network. +func (vpc *VpcV1) ListClusterNetworkSubnets(listClusterNetworkSubnetsOptions *ListClusterNetworkSubnetsOptions) (result *ClusterNetworkSubnetCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListClusterNetworkSubnetsWithContext(context.Background(), listClusterNetworkSubnetsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetFloatingIPWithContext is an alternate form of the GetFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getFloatingIPOptions, "getFloatingIPOptions cannot be nil") +// ListClusterNetworkSubnetsWithContext is an alternate form of the ListClusterNetworkSubnets method which supports a Context parameter +func (vpc *VpcV1) ListClusterNetworkSubnetsWithContext(ctx context.Context, listClusterNetworkSubnetsOptions *ListClusterNetworkSubnetsOptions) (result *ClusterNetworkSubnetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listClusterNetworkSubnetsOptions, "listClusterNetworkSubnetsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") + err = core.ValidateStruct(listClusterNetworkSubnetsOptions, "listClusterNetworkSubnetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getFloatingIPOptions.ID, + "cluster_network_id": *listClusterNetworkSubnetsOptions.ClusterNetworkID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getFloatingIPOptions.Headers { + for headerName, headerValue := range listClusterNetworkSubnetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21047,6 +21595,18 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listClusterNetworkSubnetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworkSubnetsOptions.Start)) + } + if listClusterNetworkSubnetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkSubnetsOptions.Limit)) + } + if listClusterNetworkSubnetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listClusterNetworkSubnetsOptions.Name)) + } + if listClusterNetworkSubnetsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listClusterNetworkSubnetsOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -21057,12 +21617,12 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_cluster_network_subnets", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21073,55 +21633,57 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt return } -// UpdateFloatingIP : Update a floating IP -// This request updates a floating IP's name and/or target. -func (vpc *VpcV1) UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) +// CreateClusterNetworkSubnet : Create a cluster network subnet +// This request creates a new cluster network subnet from a cluster network subnet prototype object. The prototype +// object is structured in the same way as a retrieved cluster network subnet, and contains the information necessary to +// create the new cluster network subnet. +func (vpc *VpcV1) CreateClusterNetworkSubnet(createClusterNetworkSubnetOptions *CreateClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateClusterNetworkSubnetWithContext(context.Background(), createClusterNetworkSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateFloatingIPWithContext is an alternate form of the UpdateFloatingIP method which supports a Context parameter -func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateFloatingIPOptions, "updateFloatingIPOptions cannot be nil") +// CreateClusterNetworkSubnetWithContext is an alternate form of the CreateClusterNetworkSubnet method which supports a Context parameter +func (vpc *VpcV1) CreateClusterNetworkSubnetWithContext(ctx context.Context, createClusterNetworkSubnetOptions *CreateClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createClusterNetworkSubnetOptions, "createClusterNetworkSubnetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") + err = core.ValidateStruct(createClusterNetworkSubnetOptions, "createClusterNetworkSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateFloatingIPOptions.ID, + "cluster_network_id": *createClusterNetworkSubnetOptions.ClusterNetworkID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateFloatingIPOptions.Headers { + for headerName, headerValue := range createClusterNetworkSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnet") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) + _, err = builder.SetBodyContentJSON(createClusterNetworkSubnetOptions.ClusterNetworkSubnetPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21136,12 +21698,12 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_cluster_network_subnet", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21152,38 +21714,46 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin return } -// ListNetworkAcls : List network ACLs -// This request lists network ACLs in the region. A network ACL defines a set of packet filtering (5-tuple) rules for -// all traffic in and out of a subnet. Both allow and deny rules can be defined, and rules are stateless such that -// reverse traffic in response to allowed traffic is not automatically permitted. -func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) +// ListClusterNetworkSubnetReservedIps : List cluster network subnet reserved IPs +// This request lists cluster network subnet reserved IPs in the cluster network. +func (vpc *VpcV1) ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptions *ListClusterNetworkSubnetReservedIpsOptions) (result *ClusterNetworkSubnetReservedIPCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListClusterNetworkSubnetReservedIpsWithContext(context.Background(), listClusterNetworkSubnetReservedIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListNetworkAclsWithContext is an alternate form of the ListNetworkAcls method which supports a Context parameter -func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listNetworkAclsOptions, "listNetworkAclsOptions") +// ListClusterNetworkSubnetReservedIpsWithContext is an alternate form of the ListClusterNetworkSubnetReservedIps method which supports a Context parameter +func (vpc *VpcV1) ListClusterNetworkSubnetReservedIpsWithContext(ctx context.Context, listClusterNetworkSubnetReservedIpsOptions *ListClusterNetworkSubnetReservedIpsOptions) (result *ClusterNetworkSubnetReservedIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listClusterNetworkSubnetReservedIpsOptions, "listClusterNetworkSubnetReservedIpsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listClusterNetworkSubnetReservedIpsOptions, "listClusterNetworkSubnetReservedIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "cluster_network_id": *listClusterNetworkSubnetReservedIpsOptions.ClusterNetworkID, + "cluster_network_subnet_id": *listClusterNetworkSubnetReservedIpsOptions.ClusterNetworkSubnetID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listNetworkAclsOptions.Headers { + for headerName, headerValue := range listClusterNetworkSubnetReservedIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnetReservedIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21191,14 +21761,17 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listNetworkAclsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) + if listClusterNetworkSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Start)) } - if listNetworkAclsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) + if listClusterNetworkSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Limit)) } - if listNetworkAclsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) + if listClusterNetworkSubnetReservedIpsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Name)) + } + if listClusterNetworkSubnetReservedIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Sort)) } request, err := builder.Build() @@ -21210,12 +21783,12 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_network_acls", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_cluster_network_subnet_reserved_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIPCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21226,43 +21799,48 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl return } -// CreateNetworkACL : Create a network ACL -// This request creates a new stateless network ACL from a network ACL prototype object. The prototype object is -// structured in the same way as a retrieved network ACL, and contains the information necessary to create the new -// network ACL. -func (vpc *VpcV1) CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) +// CreateClusterNetworkSubnetReservedIP : Create a cluster network subnet reserved IP +// This request creates a new cluster network subnet reserved IP from a cluster network subnet reserved IP prototype +// object. The prototype object is structured in the same way as a retrieved cluster network subnet reserved IP, and +// contains the information necessary to create the new cluster network subnet reserved IP. +func (vpc *VpcV1) CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptions *CreateClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateClusterNetworkSubnetReservedIPWithContext(context.Background(), createClusterNetworkSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateNetworkACLWithContext is an alternate form of the CreateNetworkACL method which supports a Context parameter -func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createNetworkACLOptions, "createNetworkACLOptions cannot be nil") +// CreateClusterNetworkSubnetReservedIPWithContext is an alternate form of the CreateClusterNetworkSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) CreateClusterNetworkSubnetReservedIPWithContext(ctx context.Context, createClusterNetworkSubnetReservedIPOptions *CreateClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createClusterNetworkSubnetReservedIPOptions, "createClusterNetworkSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") + err = core.ValidateStruct(createClusterNetworkSubnetReservedIPOptions, "createClusterNetworkSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "cluster_network_id": *createClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, + "cluster_network_subnet_id": *createClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createNetworkACLOptions.Headers { + for headerName, headerValue := range createClusterNetworkSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21272,7 +21850,14 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) + body := make(map[string]interface{}) + if createClusterNetworkSubnetReservedIPOptions.Address != nil { + body["address"] = createClusterNetworkSubnetReservedIPOptions.Address + } + if createClusterNetworkSubnetReservedIPOptions.Name != nil { + body["name"] = createClusterNetworkSubnetReservedIPOptions.Name + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21287,12 +21872,12 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_cluster_network_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21303,49 +21888,57 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork return } -// DeleteNetworkACL : Delete a network ACL -// This request deletes a network ACL. This operation cannot be reversed. For this request to succeed, the network ACL -// must not be the default network ACL for any VPCs, and the network ACL must not be attached to any subnets. -func (vpc *VpcV1) DeleteNetworkACL(deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) +// DeleteClusterNetworkSubnetReservedIP : Delete a cluster network subnet reserved IP +// This request deletes a cluster network subnet reserved IP. This operation cannot be reversed. +// +// For this request to succeed, the reserved IP must be unbound. A provider-owned reserved IP is not allowed to be +// deleted. +func (vpc *VpcV1) DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptions *DeleteClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteClusterNetworkSubnetReservedIPWithContext(context.Background(), deleteClusterNetworkSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteNetworkACLWithContext is an alternate form of the DeleteNetworkACL method which supports a Context parameter -func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteNetworkACLOptions, "deleteNetworkACLOptions cannot be nil") +// DeleteClusterNetworkSubnetReservedIPWithContext is an alternate form of the DeleteClusterNetworkSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) DeleteClusterNetworkSubnetReservedIPWithContext(ctx context.Context, deleteClusterNetworkSubnetReservedIPOptions *DeleteClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteClusterNetworkSubnetReservedIPOptions, "deleteClusterNetworkSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") + err = core.ValidateStruct(deleteClusterNetworkSubnetReservedIPOptions, "deleteClusterNetworkSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteNetworkACLOptions.ID, + "cluster_network_id": *deleteClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, + "cluster_network_subnet_id": *deleteClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, + "id": *deleteClusterNetworkSubnetReservedIPOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteNetworkACLOptions.Headers { + for headerName, headerValue := range deleteClusterNetworkSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + if deleteClusterNetworkSubnetReservedIPOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkSubnetReservedIPOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -21356,55 +21949,66 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_cluster_network_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetNetworkACL : Retrieve a network ACL -// This request retrieves a single network ACL specified by the identifier in the URL. -func (vpc *VpcV1) GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) +// GetClusterNetworkSubnetReservedIP : Retrieve a cluster network subnet reserved IP +// This request retrieves a single cluster network subnet reserved IP specified by the identifier in the URL. +func (vpc *VpcV1) GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptions *GetClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetClusterNetworkSubnetReservedIPWithContext(context.Background(), getClusterNetworkSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetNetworkACLWithContext is an alternate form of the GetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkACLOptions, "getNetworkACLOptions cannot be nil") +// GetClusterNetworkSubnetReservedIPWithContext is an alternate form of the GetClusterNetworkSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) GetClusterNetworkSubnetReservedIPWithContext(ctx context.Context, getClusterNetworkSubnetReservedIPOptions *GetClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getClusterNetworkSubnetReservedIPOptions, "getClusterNetworkSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") + err = core.ValidateStruct(getClusterNetworkSubnetReservedIPOptions, "getClusterNetworkSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getNetworkACLOptions.ID, + "cluster_network_id": *getClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, + "cluster_network_subnet_id": *getClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, + "id": *getClusterNetworkSubnetReservedIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getNetworkACLOptions.Headers { + for headerName, headerValue := range getClusterNetworkSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21422,12 +22026,12 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_cluster_network_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21438,55 +22042,62 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt return } -// UpdateNetworkACL : Update a network ACL -// This request updates a network ACL's name. -func (vpc *VpcV1) UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) +// UpdateClusterNetworkSubnetReservedIP : Update a cluster network subnet reserved IP +// This request updates a cluster network subnet reserved IP with the information provided in a cluster network subnet +// reserved IP patch object. The patch object is structured in the same way as a retrieved cluster network subnet +// reserved IP and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptions *UpdateClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateClusterNetworkSubnetReservedIPWithContext(context.Background(), updateClusterNetworkSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateNetworkACLWithContext is an alternate form of the UpdateNetworkACL method which supports a Context parameter -func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateNetworkACLOptions, "updateNetworkACLOptions cannot be nil") +// UpdateClusterNetworkSubnetReservedIPWithContext is an alternate form of the UpdateClusterNetworkSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) UpdateClusterNetworkSubnetReservedIPWithContext(ctx context.Context, updateClusterNetworkSubnetReservedIPOptions *UpdateClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateClusterNetworkSubnetReservedIPOptions, "updateClusterNetworkSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") + err = core.ValidateStruct(updateClusterNetworkSubnetReservedIPOptions, "updateClusterNetworkSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateNetworkACLOptions.ID, + "cluster_network_id": *updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkID, + "cluster_network_subnet_id": *updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID, + "id": *updateClusterNetworkSubnetReservedIPOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateNetworkACLOptions.Headers { + for headerName, headerValue := range updateClusterNetworkSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateClusterNetworkSubnetReservedIPOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateClusterNetworkSubnetReservedIPOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) + _, err = builder.SetBodyContentJSON(updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetReservedIPPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21501,12 +22112,12 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_cluster_network_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21517,62 +22128,131 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork return } -// ListNetworkACLRules : List rules for a network ACL -// This request lists rules for a network ACL. These rules can allow or deny traffic between a source CIDR block and a -// destination CIDR block over a particular protocol and port range. -func (vpc *VpcV1) ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) +// DeleteClusterNetworkSubnet : Delete a cluster network subnet +// This request deletes a cluster network subnet. This operation cannot be reversed. +// +// For this request to succeed, this cluster subnet must not be attached to a cluster network interface. +func (vpc *VpcV1) DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptions *DeleteClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteClusterNetworkSubnetWithContext(context.Background(), deleteClusterNetworkSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListNetworkACLRulesWithContext is an alternate form of the ListNetworkACLRules method which supports a Context parameter -func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listNetworkACLRulesOptions, "listNetworkACLRulesOptions cannot be nil") +// DeleteClusterNetworkSubnetWithContext is an alternate form of the DeleteClusterNetworkSubnet method which supports a Context parameter +func (vpc *VpcV1) DeleteClusterNetworkSubnetWithContext(ctx context.Context, deleteClusterNetworkSubnetOptions *DeleteClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteClusterNetworkSubnetOptions, "deleteClusterNetworkSubnetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") + err = core.ValidateStruct(deleteClusterNetworkSubnetOptions, "deleteClusterNetworkSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "network_acl_id": *listNetworkACLRulesOptions.NetworkACLID, + "cluster_network_id": *deleteClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *deleteClusterNetworkSubnetOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listNetworkACLRulesOptions.Headers { + for headerName, headerValue := range deleteClusterNetworkSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnet") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if deleteClusterNetworkSubnetOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkSubnetOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listNetworkACLRulesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if listNetworkACLRulesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "delete_cluster_network_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } - if listNetworkACLRulesOptions.Direction != nil { - builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetClusterNetworkSubnet : Retrieve a cluster network subnet +// This request retrieves a single cluster network subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetClusterNetworkSubnet(getClusterNetworkSubnetOptions *GetClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetClusterNetworkSubnetWithContext(context.Background(), getClusterNetworkSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetClusterNetworkSubnetWithContext is an alternate form of the GetClusterNetworkSubnet method which supports a Context parameter +func (vpc *VpcV1) GetClusterNetworkSubnetWithContext(ctx context.Context, getClusterNetworkSubnetOptions *GetClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getClusterNetworkSubnetOptions, "getClusterNetworkSubnetOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getClusterNetworkSubnetOptions, "getClusterNetworkSubnetOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "cluster_network_id": *getClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *getClusterNetworkSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getClusterNetworkSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -21583,12 +22263,12 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_network_acl_rules", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_cluster_network_subnet", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21599,56 +22279,61 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor return } -// CreateNetworkACLRule : Create a rule for a network ACL -// This request creates a new rule from a network ACL rule prototype object. The prototype object is structured in the -// same way as a retrieved rule, and contains the information necessary to create the new rule. -func (vpc *VpcV1) CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) +// UpdateClusterNetworkSubnet : Update a cluster network subnet +// This request updates a cluster network subnet with the information provided in a cluster network subnet patch object. +// The patch object is structured in the same way as a retrieved cluster network subnet and needs to contain only the +// information to be updated. +func (vpc *VpcV1) UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptions *UpdateClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateClusterNetworkSubnetWithContext(context.Background(), updateClusterNetworkSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateNetworkACLRuleWithContext is an alternate form of the CreateNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createNetworkACLRuleOptions, "createNetworkACLRuleOptions cannot be nil") +// UpdateClusterNetworkSubnetWithContext is an alternate form of the UpdateClusterNetworkSubnet method which supports a Context parameter +func (vpc *VpcV1) UpdateClusterNetworkSubnetWithContext(ctx context.Context, updateClusterNetworkSubnetOptions *UpdateClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateClusterNetworkSubnetOptions, "updateClusterNetworkSubnetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + err = core.ValidateStruct(updateClusterNetworkSubnetOptions, "updateClusterNetworkSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + "cluster_network_id": *updateClusterNetworkSubnetOptions.ClusterNetworkID, + "id": *updateClusterNetworkSubnetOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + for headerName, headerValue := range updateClusterNetworkSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnet") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateClusterNetworkSubnetOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateClusterNetworkSubnetOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + _, err = builder.SetBodyContentJSON(updateClusterNetworkSubnetOptions.ClusterNetworkSubnetPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21663,12 +22348,12 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_network_acl_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_cluster_network_subnet", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21679,49 +22364,54 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet return } -// DeleteNetworkACLRule : Delete a network ACL rule -// This request deletes a rule. This operation cannot be reversed. -func (vpc *VpcV1) DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +// DeleteClusterNetwork : Delete a cluster network +// This request deletes a cluster network. This operation cannot be reversed. +// +// For this request to succeed, virtual server instances must not reside in this cluster network. +func (vpc *VpcV1) DeleteClusterNetwork(deleteClusterNetworkOptions *DeleteClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteClusterNetworkWithContext(context.Background(), deleteClusterNetworkOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteNetworkACLRuleWithContext is an alternate form of the DeleteNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions cannot be nil") +// DeleteClusterNetworkWithContext is an alternate form of the DeleteClusterNetwork method which supports a Context parameter +func (vpc *VpcV1) DeleteClusterNetworkWithContext(ctx context.Context, deleteClusterNetworkOptions *DeleteClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteClusterNetworkOptions, "deleteClusterNetworkOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + err = core.ValidateStruct(deleteClusterNetworkOptions, "deleteClusterNetworkOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, - "id": *deleteNetworkACLRuleOptions.ID, + "id": *deleteClusterNetworkOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + for headerName, headerValue := range deleteClusterNetworkOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetwork") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + if deleteClusterNetworkOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -21732,56 +22422,64 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_network_acl_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_cluster_network", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetNetworkACLRule : Retrieve a network ACL rule -// This request retrieves a single rule specified by the identifier in the URL. -func (vpc *VpcV1) GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) +// GetClusterNetwork : Retrieve a cluster network +// This request retrieves a single cluster network specified by the identifier in the URL. +func (vpc *VpcV1) GetClusterNetwork(getClusterNetworkOptions *GetClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetClusterNetworkWithContext(context.Background(), getClusterNetworkOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetNetworkACLRuleWithContext is an alternate form of the GetNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkACLRuleOptions, "getNetworkACLRuleOptions cannot be nil") +// GetClusterNetworkWithContext is an alternate form of the GetClusterNetwork method which supports a Context parameter +func (vpc *VpcV1) GetClusterNetworkWithContext(ctx context.Context, getClusterNetworkOptions *GetClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getClusterNetworkOptions, "getClusterNetworkOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + err = core.ValidateStruct(getClusterNetworkOptions, "getClusterNetworkOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, - "id": *getNetworkACLRuleOptions.ID, + "id": *getClusterNetworkOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getNetworkACLRuleOptions.Headers { + for headerName, headerValue := range getClusterNetworkOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetwork") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21799,12 +22497,12 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_network_acl_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_cluster_network", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21815,58 +22513,60 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC return } -// UpdateNetworkACLRule : Update a network ACL rule -// This request updates a rule with the information in a provided rule patch. The rule patch object contains only the -// information to be updated. The request will fail if the provided patch includes properties that are not used by the -// rule's protocol. -func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) +// UpdateClusterNetwork : Update a cluster +// This request updates a cluster network with the information provided in a cluster network patch object. The patch +// object is structured in the same way as a retrieved cluster network and needs to contain only the information to be +// updated. +func (vpc *VpcV1) UpdateClusterNetwork(updateClusterNetworkOptions *UpdateClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateClusterNetworkWithContext(context.Background(), updateClusterNetworkOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateNetworkACLRuleWithContext is an alternate form of the UpdateNetworkACLRule method which supports a Context parameter -func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions cannot be nil") +// UpdateClusterNetworkWithContext is an alternate form of the UpdateClusterNetwork method which supports a Context parameter +func (vpc *VpcV1) UpdateClusterNetworkWithContext(ctx context.Context, updateClusterNetworkOptions *UpdateClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateClusterNetworkOptions, "updateClusterNetworkOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") + err = core.ValidateStruct(updateClusterNetworkOptions, "updateClusterNetworkOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, - "id": *updateNetworkACLRuleOptions.ID, + "id": *updateClusterNetworkOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { + for headerName, headerValue := range updateClusterNetworkOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetwork") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateClusterNetworkOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateClusterNetworkOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) + _, err = builder.SetBodyContentJSON(updateClusterNetworkOptions.ClusterNetworkPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21881,12 +22581,12 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_network_acl_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_cluster_network", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21897,20 +22597,19 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet return } -// ListSecurityGroups : List security groups -// This request lists security groups in the region. Security groups provide a way to apply IP filtering rules to -// instances in the associated VPC. With security groups, all traffic is denied by default, and rules added to security -// groups define which traffic the security group permits. Security group rules are stateful such that reverse traffic -// in response to allowed traffic is automatically permitted. -func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) +// ListPublicGateways : List public gateways +// This request lists public gateways in the region. A public gateway is a virtual network device associated with a VPC, +// which allows access to the Internet. A public gateway resides in a zone and can be connected to subnets in the same +// zone only. +func (vpc *VpcV1) ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSecurityGroupsWithContext is an alternate form of the ListSecurityGroups method which supports a Context parameter -func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSecurityGroupsOptions, "listSecurityGroupsOptions") +// ListPublicGatewaysWithContext is an alternate form of the ListPublicGateways method which supports a Context parameter +func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPublicGatewaysOptions, "listPublicGatewaysOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -21919,17 +22618,17 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSecurityGroupsOptions.Headers { + for headerName, headerValue := range listPublicGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21937,23 +22636,14 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSecurityGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) - } - if listSecurityGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) - } - if listSecurityGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) - } - if listSecurityGroupsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) + if listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) } - if listSecurityGroupsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) } - if listSecurityGroupsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) } request, err := builder.Build() @@ -21965,12 +22655,12 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_security_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_public_gateways", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21981,25 +22671,27 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit return } -// CreateSecurityGroup : Create a security group -// This request creates a new security group from a security group prototype object. The prototype object is structured -// in the same way as a retrieved security group, and contains the information necessary to create the new security -// group. If security group rules are included in the prototype object, those rules will be added to the security group. -// Each security group is scoped to one VPC. Only resources in that VPC can be added to the security group. -func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) +// CreatePublicGateway : Create a public gateway +// This request creates a new public gateway from a public gateway prototype object. For this to succeed, the VPC must +// not already have a public gateway in the specified zone. +// +// If a floating IP is provided, it must be unbound. If a floating IP is not provided, one will be created and bound to +// the public gateway. Once a public gateway has been created, its floating IP cannot be unbound. A public gateway must +// be explicitly attached to each subnet it will provide connectivity for. +func (vpc *VpcV1) CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSecurityGroupWithContext is an alternate form of the CreateSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSecurityGroupOptions, "createSecurityGroupOptions cannot be nil") +// CreatePublicGatewayWithContext is an alternate form of the CreatePublicGateway method which supports a Context parameter +func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPublicGatewayOptions, "createPublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") + err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -22008,17 +22700,17 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSecurityGroupOptions.Headers { + for headerName, headerValue := range createPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22029,17 +22721,20 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createSecurityGroupOptions.VPC != nil { - body["vpc"] = createSecurityGroupOptions.VPC + if createPublicGatewayOptions.VPC != nil { + body["vpc"] = createPublicGatewayOptions.VPC } - if createSecurityGroupOptions.Name != nil { - body["name"] = createSecurityGroupOptions.Name + if createPublicGatewayOptions.Zone != nil { + body["zone"] = createPublicGatewayOptions.Zone } - if createSecurityGroupOptions.ResourceGroup != nil { - body["resource_group"] = createSecurityGroupOptions.ResourceGroup + if createPublicGatewayOptions.FloatingIP != nil { + body["floating_ip"] = createPublicGatewayOptions.FloatingIP } - if createSecurityGroupOptions.Rules != nil { - body["rules"] = createSecurityGroupOptions.Rules + if createPublicGatewayOptions.Name != nil { + body["name"] = createPublicGatewayOptions.Name + } + if createPublicGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createPublicGatewayOptions.ResourceGroup } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -22056,12 +22751,12 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_security_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22072,46 +22767,47 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu return } -// DeleteSecurityGroup : Delete a security group -// This request deletes a security group. A security group cannot be deleted if it is referenced by any security group -// targets or rules. Additionally, a VPC's default security group cannot be deleted. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) +// DeletePublicGateway : Delete a public gateway +// This request deletes a public gateway. This operation cannot be reversed. For this request to succeed, the public +// gateway must not be attached to any subnets. The public gateway's floating IP will be automatically unbound. If the +// floating IP was created when the public gateway was created, it will be deleted. +func (vpc *VpcV1) DeletePublicGateway(deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSecurityGroupWithContext is an alternate form of the DeleteSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSecurityGroupOptions, "deleteSecurityGroupOptions cannot be nil") +// DeletePublicGatewayWithContext is an alternate form of the DeletePublicGateway method which supports a Context parameter +func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePublicGatewayOptions, "deletePublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSecurityGroupOptions.ID, + "id": *deletePublicGatewayOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSecurityGroupOptions.Headers { + for headerName, headerValue := range deletePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22127,7 +22823,7 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_security_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -22135,45 +22831,45 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu return } -// GetSecurityGroup : Retrieve a security group -// This request retrieves a single security group specified by the identifier in the URL path. -func (vpc *VpcV1) GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) +// GetPublicGateway : Retrieve a public gateway +// This request retrieves a single public gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSecurityGroupWithContext is an alternate form of the GetSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSecurityGroupOptions, "getSecurityGroupOptions cannot be nil") +// GetPublicGatewayWithContext is an alternate form of the GetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPublicGatewayOptions, "getPublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") + err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSecurityGroupOptions.ID, + "id": *getPublicGatewayOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSecurityGroupOptions.Headers { + for headerName, headerValue := range getPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22191,12 +22887,12 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_security_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22207,47 +22903,45 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr return } -// UpdateSecurityGroup : Update a security group -// This request updates a security group with the information provided in a security group patch object. The security -// group patch object is structured in the same way as a retrieved security group and contains only the information to -// be updated. -func (vpc *VpcV1) UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) +// UpdatePublicGateway : Update a public gateway +// This request updates a public gateway's name. +func (vpc *VpcV1) UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSecurityGroupWithContext is an alternate form of the UpdateSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSecurityGroupOptions, "updateSecurityGroupOptions cannot be nil") +// UpdatePublicGatewayWithContext is an alternate form of the UpdatePublicGateway method which supports a Context parameter +func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePublicGatewayOptions, "updatePublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") + err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSecurityGroupOptions.ID, + "id": *updatePublicGatewayOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSecurityGroupOptions.Headers { + for headerName, headerValue := range updatePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22257,7 +22951,7 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -22272,12 +22966,12 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_security_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22288,46 +22982,37 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu return } -// ListSecurityGroupRules : List rules in a security group -// This request lists rules in a security group. These rules define what traffic the security group permits. Security -// group rules are stateful, such that reverse traffic in response to allowed traffic is automatically permitted. -func (vpc *VpcV1) ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) +// ListFloatingIps : List floating IPs +// This request lists floating IPs in the region. Floating IPs allow inbound and outbound traffic from the Internet to +// an instance. +func (vpc *VpcV1) ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSecurityGroupRulesWithContext is an alternate form of the ListSecurityGroupRules method which supports a Context parameter -func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") +// ListFloatingIpsWithContext is an alternate form of the ListFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFloatingIpsOptions, "listFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { + for headerName, headerValue := range listFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22335,6 +23020,30 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) + } + if listFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFloatingIpsOptions.Limit)) + } + if listFloatingIpsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFloatingIpsOptions.ResourceGroupID)) + } + if listFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort)) + } + if listFloatingIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFloatingIpsOptions.TargetID)) + } + if listFloatingIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listFloatingIpsOptions.TargetCRN)) + } + if listFloatingIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName)) + } + if listFloatingIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType)) + } request, err := builder.Build() if err != nil { @@ -22345,12 +23054,12 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_security_group_rules", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_floating_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22361,50 +23070,41 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec return } -// CreateSecurityGroupRule : Create a rule for a security group -// This request creates a new security group rule from a security group rule prototype object. The prototype object is -// structured in the same way as a retrieved security group rule and contains the information necessary to create the -// rule. As part of creating a new rule in a security group, the rule is applied to all the networking interfaces in the -// security group. Rules specify which IP traffic a security group will allow. Security group rules are stateful, such -// that reverse traffic in response to allowed traffic is automatically permitted. A rule allowing inbound TCP traffic -// on port 80 also allows outbound TCP traffic on port 80 without the need for an additional rule. -func (vpc *VpcV1) CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) +// CreateFloatingIP : Reserve a floating IP +// This request reserves a new floating IP. +func (vpc *VpcV1) CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSecurityGroupRuleWithContext is an alternate form of the CreateSecurityGroupRule method which supports a Context parameter -func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions cannot be nil") +// CreateFloatingIPWithContext is an alternate form of the CreateFloatingIP method which supports a Context parameter +func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createFloatingIPOptions, "createFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range createFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22414,7 +23114,7 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) + _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -22429,12 +23129,12 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_security_group_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22445,47 +23145,46 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create return } -// DeleteSecurityGroupRule : Delete a security group rule -// This request deletes a security group rule. This operation cannot be reversed. Removing a security group rule will -// not end existing connections allowed by that rule. -func (vpc *VpcV1) DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) +// DeleteFloatingIP : Delete a floating IP +// This request disassociates (if associated) and releases a floating IP. This operation cannot be reversed. For this +// request to succeed, the floating IP must not be required by another resource, such as a public gateway. +func (vpc *VpcV1) DeleteFloatingIP(deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSecurityGroupRuleWithContext is an alternate form of the DeleteSecurityGroupRule method which supports a Context parameter -func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions cannot be nil") +// DeleteFloatingIPWithContext is an alternate form of the DeleteFloatingIP method which supports a Context parameter +func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteFloatingIPOptions, "deleteFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, - "id": *deleteSecurityGroupRuleOptions.ID, + "id": *deleteFloatingIPOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range deleteFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22501,7 +23200,7 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_security_group_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -22509,46 +23208,45 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete return } -// GetSecurityGroupRule : Retrieve a security group rule -// This request retrieves a single security group rule specified by the identifier in the URL path. -func (vpc *VpcV1) GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) +// GetFloatingIP : Retrieve a floating IP +// This request retrieves a single floating IP specified by the identifier in the URL. +func (vpc *VpcV1) GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSecurityGroupRuleWithContext is an alternate form of the GetSecurityGroupRule method which supports a Context parameter -func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions cannot be nil") +// GetFloatingIPWithContext is an alternate form of the GetFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getFloatingIPOptions, "getFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *getSecurityGroupRuleOptions.SecurityGroupID, - "id": *getSecurityGroupRuleOptions.ID, + "id": *getFloatingIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range getFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22566,12 +23264,12 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_security_group_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22582,48 +23280,45 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri return } -// UpdateSecurityGroupRule : Update a security group rule -// This request updates a security group rule with the information in a provided rule patch object. The rule patch -// object contains only the information to be updated. The request will fail if the provided patch includes properties -// that are not used by the rule's protocol. -func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) +// UpdateFloatingIP : Update a floating IP +// This request updates a floating IP's name and/or target. +func (vpc *VpcV1) UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSecurityGroupRuleWithContext is an alternate form of the UpdateSecurityGroupRule method which supports a Context parameter -func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions cannot be nil") +// UpdateFloatingIPWithContext is an alternate form of the UpdateFloatingIP method which supports a Context parameter +func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFloatingIPOptions, "updateFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, - "id": *updateSecurityGroupRuleOptions.ID, + "id": *updateFloatingIPOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range updateFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22633,7 +23328,7 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -22648,12 +23343,12 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_security_group_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22664,45 +23359,38 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update return } -// ListSecurityGroupTargets : List targets associated with a security group -// This request lists targets associated with a security group, to which the rules in the security group are applied. -func (vpc *VpcV1) ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) +// ListNetworkAcls : List network ACLs +// This request lists network ACLs in the region. A network ACL defines a set of packet filtering (5-tuple) rules for +// all traffic in and out of a subnet. Both allow and deny rules can be defined, and rules are stateless such that +// reverse traffic in response to allowed traffic is not automatically permitted. +func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSecurityGroupTargetsWithContext is an alternate form of the ListSecurityGroupTargets method which supports a Context parameter -func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") +// ListNetworkAclsWithContext is an alternate form of the ListNetworkAcls method which supports a Context parameter +func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listNetworkAclsOptions, "listNetworkAclsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { + for headerName, headerValue := range listNetworkAclsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22710,11 +23398,14 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSecurityGroupTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) + if listNetworkAclsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) } - if listSecurityGroupTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + if listNetworkAclsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) + } + if listNetworkAclsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) } request, err := builder.Build() @@ -22726,12 +23417,12 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_security_group_targets", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_network_acls", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22742,125 +23433,126 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS return } -// DeleteSecurityGroupTargetBinding : Remove a target from a security group -// This request removes a target from a security group. For this request to succeed, the target must be attached to at -// least one other security group. The specified target identifier can be: -// -// - A bare metal server network interface identifier -// - A virtual network interface identifier -// - A VPN server identifier -// - A load balancer identifier -// - An endpoint gateway identifier -// - An instance network interface identifier -// -// Security groups are stateful, so any changes to a target's security groups are applied to new connections. Existing -// connections are not affected. -func (vpc *VpcV1) DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) +// CreateNetworkACL : Create a network ACL +// This request creates a new stateless network ACL from a network ACL prototype object. The prototype object is +// structured in the same way as a retrieved network ACL, and contains the information necessary to create the new +// network ACL. +func (vpc *VpcV1) CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSecurityGroupTargetBindingWithContext is an alternate form of the DeleteSecurityGroupTargetBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Context, deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions cannot be nil") +// CreateNetworkACLWithContext is an alternate form of the CreateNetworkACL method which supports a Context parameter +func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createNetworkACLOptions, "createNetworkACLOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *deleteSecurityGroupTargetBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range createNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_security_group_target_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_network_acl", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetSecurityGroupTarget : Retrieve a security group target -// This request retrieves a single target specified by the identifier in the URL path. The target must be an existing -// target of the security group. -func (vpc *VpcV1) GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) +// DeleteNetworkACL : Delete a network ACL +// This request deletes a network ACL. This operation cannot be reversed. For this request to succeed, the network ACL +// must not be the default network ACL for any VPCs, and the network ACL must not be attached to any subnets. +func (vpc *VpcV1) DeleteNetworkACL(deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSecurityGroupTargetWithContext is an alternate form of the GetSecurityGroupTarget method which supports a Context parameter -func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions cannot be nil") +// DeleteNetworkACLWithContext is an alternate form of the DeleteNetworkACL method which supports a Context parameter +func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteNetworkACLOptions, "deleteNetworkACLOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, - "id": *getSecurityGroupTargetOptions.ID, + "id": *deleteNetworkACLOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { + for headerName, headerValue := range deleteNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -22871,75 +23563,55 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_security_group_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_network_acl", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateSecurityGroupTargetBinding : Add a target to a security group -// This request adds a resource to an existing security group. The specified target identifier can be: -// -// - A bare metal server network interface identifier -// - A virtual network interface identifier -// - A VPN server identifier -// - A load balancer identifier -// - An endpoint gateway identifier -// - An instance network interface identifier -// -// When a target is added to a security group, the security group rules are applied to the target. A request body is not -// required, and if provided, is ignored. -func (vpc *VpcV1) CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) +// GetNetworkACL : Retrieve a network ACL +// This request retrieves a single network ACL specified by the identifier in the URL. +func (vpc *VpcV1) GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSecurityGroupTargetBindingWithContext is an alternate form of the CreateSecurityGroupTargetBinding method which supports a Context parameter -func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Context, createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions cannot be nil") +// GetNetworkACLWithContext is an alternate form of the GetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkACLOptions, "getNetworkACLOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *createSecurityGroupTargetBindingOptions.ID, + "id": *getNetworkACLOptions.ID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range getNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22957,12 +23629,12 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_security_group_target_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_network_acl", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22973,48 +23645,58 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex return } -// ListIkePolicies : List IKE policies -// This request lists IKE policies in the region. -func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) +// UpdateNetworkACL : Update a network ACL +// This request updates a network ACL's name. +func (vpc *VpcV1) UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListIkePoliciesWithContext is an alternate form of the ListIkePolicies method which supports a Context parameter -func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listIkePoliciesOptions, "listIkePoliciesOptions") +// UpdateNetworkACLWithContext is an alternate form of the UpdateNetworkACL method which supports a Context parameter +func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateNetworkACLOptions, "updateNetworkACLOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updateNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listIkePoliciesOptions.Headers { + for headerName, headerValue := range updateNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listIkePoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) - } - if listIkePoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIkePoliciesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -23026,12 +23708,12 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_ike_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_network_acl", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23042,76 +23724,61 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie return } -// CreateIkePolicy : Create an IKE policy -// This request creates a new IKE policy. -func (vpc *VpcV1) CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) +// ListNetworkACLRules : List rules for a network ACL +// This request lists rules for a network ACL. These rules can allow or deny traffic between a source CIDR block and a +// destination CIDR block over a particular protocol and port range. +func (vpc *VpcV1) ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateIkePolicyWithContext is an alternate form of the CreateIkePolicy method which supports a Context parameter -func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createIkePolicyOptions, "createIkePolicyOptions cannot be nil") +// ListNetworkACLRulesWithContext is an alternate form of the ListNetworkACLRules method which supports a Context parameter +func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkACLRulesOptions, "listNetworkACLRulesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") + err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "network_acl_id": *listNetworkACLRulesOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createIkePolicyOptions.Headers { + for headerName, headerValue := range listNetworkACLRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - - body := make(map[string]interface{}) - if createIkePolicyOptions.AuthenticationAlgorithm != nil { - body["authentication_algorithm"] = createIkePolicyOptions.AuthenticationAlgorithm - } - if createIkePolicyOptions.DhGroup != nil { - body["dh_group"] = createIkePolicyOptions.DhGroup - } - if createIkePolicyOptions.EncryptionAlgorithm != nil { - body["encryption_algorithm"] = createIkePolicyOptions.EncryptionAlgorithm - } - if createIkePolicyOptions.IkeVersion != nil { - body["ike_version"] = createIkePolicyOptions.IkeVersion - } - if createIkePolicyOptions.KeyLifetime != nil { - body["key_lifetime"] = createIkePolicyOptions.KeyLifetime - } - if createIkePolicyOptions.Name != nil { - body["name"] = createIkePolicyOptions.Name + if listNetworkACLRulesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) } - if createIkePolicyOptions.ResourceGroup != nil { - body["resource_group"] = createIkePolicyOptions.ResourceGroup + if listNetworkACLRulesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listNetworkACLRulesOptions.Direction != nil { + builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) } request, err := builder.Build() @@ -23123,12 +23790,12 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_ike_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_network_acl_rules", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23139,112 +23806,129 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic return } -// DeleteIkePolicy : Delete an IKE policy -// This request deletes an IKE policy. This operation cannot be reversed. For this request to succeed, there must not be -// any VPN gateway connections using this policy. -func (vpc *VpcV1) DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) +// CreateNetworkACLRule : Create a rule for a network ACL +// This request creates a new rule from a network ACL rule prototype object. The prototype object is structured in the +// same way as a retrieved rule, and contains the information necessary to create the new rule. +func (vpc *VpcV1) CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteIkePolicyWithContext is an alternate form of the DeleteIkePolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteIkePolicyOptions, "deleteIkePolicyOptions cannot be nil") +// CreateNetworkACLRuleWithContext is an alternate form of the CreateNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createNetworkACLRuleOptions, "createNetworkACLRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteIkePolicyOptions.ID, + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteIkePolicyOptions.Headers { + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_ike_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_network_acl_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetIkePolicy : Retrieve an IKE policy -// This request retrieves a single IKE policy specified by the identifier in the URL. -func (vpc *VpcV1) GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) +// DeleteNetworkACLRule : Delete a network ACL rule +// This request deletes a rule. This operation cannot be reversed. +func (vpc *VpcV1) DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetIkePolicyWithContext is an alternate form of the GetIkePolicy method which supports a Context parameter -func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getIkePolicyOptions, "getIkePolicyOptions cannot be nil") +// DeleteNetworkACLRuleWithContext is an alternate form of the DeleteNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getIkePolicyOptions.ID, + "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, + "id": *deleteNetworkACLRuleOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getIkePolicyOptions.Headers { + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -23255,79 +23939,64 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_ike_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_network_acl_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateIkePolicy : Update an IKE policy -// This request updates the properties of an existing IKE policy. -func (vpc *VpcV1) UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) +// GetNetworkACLRule : Retrieve a network ACL rule +// This request retrieves a single rule specified by the identifier in the URL. +func (vpc *VpcV1) GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateIkePolicyWithContext is an alternate form of the UpdateIkePolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateIkePolicyOptions, "updateIkePolicyOptions cannot be nil") +// GetNetworkACLRuleWithContext is an alternate form of the GetNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkACLRuleOptions, "getNetworkACLRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateIkePolicyOptions.ID, + "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, + "id": *getNetworkACLRuleOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateIkePolicyOptions.Headers { + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -23337,12 +24006,12 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_ike_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_network_acl_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23353,57 +24022,61 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic return } -// ListIkePolicyConnections : List VPN gateway connections that use a specified IKE policy -// This request lists VPN gateway connections that use a IKE policy. -func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *IkePolicyConnectionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) +// UpdateNetworkACLRule : Update a network ACL rule +// This request updates a rule with the information in a provided rule patch. The rule patch object contains only the +// information to be updated. The request will fail if the provided patch includes properties that are not used by the +// rule's protocol. +func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *IkePolicyConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") +// UpdateNetworkACLRuleWithContext is an alternate form of the UpdateNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listIkePolicyConnectionsOptions.ID, + "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, + "id": *updateNetworkACLRuleOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { + for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listIkePolicyConnectionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIkePolicyConnectionsOptions.Start)) - } - if listIkePolicyConnectionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIkePolicyConnectionsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -23415,12 +24088,12 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_ike_policy_connections", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_network_acl_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23431,17 +24104,20 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI return } -// ListIpsecPolicies : List IPsec policies -// This request lists IPsec policies in the region. -func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) +// ListSecurityGroups : List security groups +// This request lists security groups in the region. Security groups provide a way to apply IP filtering rules to +// instances in the associated VPC. With security groups, all traffic is denied by default, and rules added to security +// groups define which traffic the security group permits. Security group rules are stateful such that reverse traffic +// in response to allowed traffic is automatically permitted. +func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListIpsecPoliciesWithContext is an alternate form of the ListIpsecPolicies method which supports a Context parameter -func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listIpsecPoliciesOptions, "listIpsecPoliciesOptions") +// ListSecurityGroupsWithContext is an alternate form of the ListSecurityGroups method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSecurityGroupsOptions, "listSecurityGroupsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -23450,17 +24126,17 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listIpsecPoliciesOptions.Headers { + for headerName, headerValue := range listSecurityGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23468,11 +24144,23 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listIpsecPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) + if listSecurityGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) } - if listIpsecPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) + if listSecurityGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) + } + if listSecurityGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) + } + if listSecurityGroupsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) + } + if listSecurityGroupsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) + } + if listSecurityGroupsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) } request, err := builder.Build() @@ -23484,12 +24172,12 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_ipsec_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_security_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23500,22 +24188,25 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol return } -// CreateIpsecPolicy : Create an IPsec policy -// This request creates a new IPsec policy. -func (vpc *VpcV1) CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) +// CreateSecurityGroup : Create a security group +// This request creates a new security group from a security group prototype object. The prototype object is structured +// in the same way as a retrieved security group, and contains the information necessary to create the new security +// group. If security group rules are included in the prototype object, those rules will be added to the security group. +// Each security group is scoped to one VPC. Only resources in that VPC can be added to the security group. +func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateIpsecPolicyWithContext is an alternate form of the CreateIpsecPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createIpsecPolicyOptions, "createIpsecPolicyOptions cannot be nil") +// CreateSecurityGroupWithContext is an alternate form of the CreateSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupOptions, "createSecurityGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") + err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -23524,17 +24215,17 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createIpsecPolicyOptions.Headers { + for headerName, headerValue := range createSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23545,23 +24236,17 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createIpsecPolicyOptions.AuthenticationAlgorithm != nil { - body["authentication_algorithm"] = createIpsecPolicyOptions.AuthenticationAlgorithm - } - if createIpsecPolicyOptions.EncryptionAlgorithm != nil { - body["encryption_algorithm"] = createIpsecPolicyOptions.EncryptionAlgorithm - } - if createIpsecPolicyOptions.Pfs != nil { - body["pfs"] = createIpsecPolicyOptions.Pfs + if createSecurityGroupOptions.VPC != nil { + body["vpc"] = createSecurityGroupOptions.VPC } - if createIpsecPolicyOptions.KeyLifetime != nil { - body["key_lifetime"] = createIpsecPolicyOptions.KeyLifetime + if createSecurityGroupOptions.Name != nil { + body["name"] = createSecurityGroupOptions.Name } - if createIpsecPolicyOptions.Name != nil { - body["name"] = createIpsecPolicyOptions.Name + if createSecurityGroupOptions.ResourceGroup != nil { + body["resource_group"] = createSecurityGroupOptions.ResourceGroup } - if createIpsecPolicyOptions.ResourceGroup != nil { - body["resource_group"] = createIpsecPolicyOptions.ResourceGroup + if createSecurityGroupOptions.Rules != nil { + body["rules"] = createSecurityGroupOptions.Rules } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -23578,12 +24263,12 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_ipsec_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_security_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23594,46 +24279,46 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP return } -// DeleteIpsecPolicy : Delete an IPsec policy -// This request deletes an IPsec policy. This operation cannot be reversed. For this request to succeed, there must not -// be any VPN gateway connections using this policy. -func (vpc *VpcV1) DeleteIpsecPolicy(deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) +// DeleteSecurityGroup : Delete a security group +// This request deletes a security group. A security group cannot be deleted if it is referenced by any security group +// targets or rules. Additionally, a VPC's default security group cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteIpsecPolicyWithContext is an alternate form of the DeleteIpsecPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions cannot be nil") +// DeleteSecurityGroupWithContext is an alternate form of the DeleteSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupOptions, "deleteSecurityGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteIpsecPolicyOptions.ID, + "id": *deleteSecurityGroupOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23649,7 +24334,7 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_ipsec_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_security_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -23657,45 +24342,45 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP return } -// GetIpsecPolicy : Retrieve an IPsec policy -// This request retrieves a single IPsec policy specified by the identifier in the URL. -func (vpc *VpcV1) GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) +// GetSecurityGroup : Retrieve a security group +// This request retrieves a single security group specified by the identifier in the URL path. +func (vpc *VpcV1) GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetIpsecPolicyWithContext is an alternate form of the GetIpsecPolicy method which supports a Context parameter -func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getIpsecPolicyOptions, "getIpsecPolicyOptions cannot be nil") +// GetSecurityGroupWithContext is an alternate form of the GetSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupOptions, "getSecurityGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getIpsecPolicyOptions.ID, + "id": *getSecurityGroupOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getIpsecPolicyOptions.Headers { + for headerName, headerValue := range getSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23713,12 +24398,12 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_ipsec_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_security_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23729,45 +24414,47 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO return } -// UpdateIpsecPolicy : Update an IPsec policy -// This request updates the properties of an existing IPsec policy. -func (vpc *VpcV1) UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) +// UpdateSecurityGroup : Update a security group +// This request updates a security group with the information provided in a security group patch object. The security +// group patch object is structured in the same way as a retrieved security group and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateIpsecPolicyWithContext is an alternate form of the UpdateIpsecPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateIpsecPolicyOptions, "updateIpsecPolicyOptions cannot be nil") +// UpdateSecurityGroupWithContext is an alternate form of the UpdateSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSecurityGroupOptions, "updateSecurityGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateIpsecPolicyOptions.ID, + "id": *updateSecurityGroupOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateIpsecPolicyOptions.Headers { + for headerName, headerValue := range updateSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23777,7 +24464,7 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) + _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -23792,12 +24479,12 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_ipsec_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_security_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23808,114 +24495,46 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP return } -// ListIpsecPolicyConnections : List VPN gateway connections that use a specified IPsec policy -// This request lists VPN gateway connections that use a IPsec policy. -func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *IPsecPolicyConnectionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) +// ListSecurityGroupRules : List rules in a security group +// This request lists rules in a security group. These rules define what traffic the security group permits. Security +// group rules are stateful, such that reverse traffic in response to allowed traffic is automatically permitted. +func (vpc *VpcV1) ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *IPsecPolicyConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") +// ListSecurityGroupRulesWithContext is an alternate form of the ListSecurityGroupRules method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listIpsecPolicyConnectionsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}/connections`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listIpsecPolicyConnectionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Start)) - } - if listIpsecPolicyConnectionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Limit)) - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "list_ipsec_policy_connections", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyConnectionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPNGateways : List VPN gateways -// This request lists VPN gateways in the region. -func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVPNGatewaysWithContext is an alternate form of the ListVPNGateways method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVPNGatewaysOptions, "listVPNGatewaysOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNGatewaysOptions.Headers { + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23923,21 +24542,6 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPNGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) - } - if listVPNGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) - } - if listVPNGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) - } - if listVPNGatewaysOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) - } - if listVPNGatewaysOptions.Mode != nil { - builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) - } request, err := builder.Build() if err != nil { @@ -23948,12 +24552,12 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_gateways", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_security_group_rules", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23964,41 +24568,50 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway return } -// CreateVPNGateway : Create a VPN gateway -// This request creates a new VPN gateway. -func (vpc *VpcV1) CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) +// CreateSecurityGroupRule : Create a rule for a security group +// This request creates a new security group rule from a security group rule prototype object. The prototype object is +// structured in the same way as a retrieved security group rule and contains the information necessary to create the +// rule. As part of creating a new rule in a security group, the rule is applied to all the networking interfaces in the +// security group. Rules specify which IP traffic a security group will allow. Security group rules are stateful, such +// that reverse traffic in response to allowed traffic is automatically permitted. A rule allowing inbound TCP traffic +// on port 80 also allows outbound TCP traffic on port 80 without the need for an additional rule. +func (vpc *VpcV1) CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPNGatewayWithContext is an alternate form of the CreateVPNGateway method which supports a Context parameter -func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNGatewayOptions, "createVPNGatewayOptions cannot be nil") +// CreateSecurityGroupRuleWithContext is an alternate form of the CreateSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNGatewayOptions.Headers { + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24008,7 +24621,7 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) + _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -24023,12 +24636,12 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpn_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_security_group_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24039,47 +24652,47 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate return } -// DeleteVPNGateway : Delete a VPN gateway -// This request deletes a VPN gateway. This operation cannot be reversed. For this request to succeed, the VPN gateway -// must not have a `status` of `pending`, and there must not be any VPC routes using the VPN gateway's connections as a -// next hop. -func (vpc *VpcV1) DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) +// DeleteSecurityGroupRule : Delete a security group rule +// This request deletes a security group rule. This operation cannot be reversed. Removing a security group rule will +// not end existing connections allowed by that rule. +func (vpc *VpcV1) DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPNGatewayWithContext is an alternate form of the DeleteVPNGateway method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNGatewayOptions, "deleteVPNGatewayOptions cannot be nil") +// DeleteSecurityGroupRuleWithContext is an alternate form of the DeleteSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVPNGatewayOptions.ID, + "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, + "id": *deleteSecurityGroupRuleOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPNGatewayOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24095,7 +24708,7 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpn_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_security_group_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -24103,45 +24716,46 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate return } -// GetVPNGateway : Retrieve a VPN gateway -// This request retrieves a single VPN gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) +// GetSecurityGroupRule : Retrieve a security group rule +// This request retrieves a single security group rule specified by the identifier in the URL path. +func (vpc *VpcV1) GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPNGatewayWithContext is an alternate form of the GetVPNGateway method which supports a Context parameter -func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNGatewayOptions, "getVPNGatewayOptions cannot be nil") +// GetSecurityGroupRuleWithContext is an alternate form of the GetSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") + err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNGatewayOptions.ID, + "security_group_id": *getSecurityGroupRuleOptions.SecurityGroupID, + "id": *getSecurityGroupRuleOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNGatewayOptions.Headers { + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24159,12 +24773,12 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_security_group_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24175,45 +24789,48 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt return } -// UpdateVPNGateway : Update a VPN gateway -// This request updates the properties of an existing VPN gateway. -func (vpc *VpcV1) UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) +// UpdateSecurityGroupRule : Update a security group rule +// This request updates a security group rule with the information in a provided rule patch object. The rule patch +// object contains only the information to be updated. The request will fail if the provided patch includes properties +// that are not used by the rule's protocol. +func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPNGatewayWithContext is an alternate form of the UpdateVPNGateway method which supports a Context parameter -func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPNGatewayOptions, "updateVPNGatewayOptions cannot be nil") +// UpdateSecurityGroupRuleWithContext is an alternate form of the UpdateSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPNGatewayOptions.ID, + "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, + "id": *updateSecurityGroupRuleOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNGatewayOptions.Headers { + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24223,7 +24840,7 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) + _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -24238,12 +24855,12 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpn_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_security_group_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24254,45 +24871,45 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate return } -// ListVPNGatewayConnections : List connections of a VPN gateway -// This request lists connections of a VPN gateway. -func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) +// ListSecurityGroupTargets : List targets associated with a security group +// This request lists targets associated with a security group, to which the rules in the security group are applied. +func (vpc *VpcV1) ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPNGatewayConnectionsWithContext is an alternate form of the ListVPNGatewayConnections method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions cannot be nil") +// ListSecurityGroupTargetsWithContext is an alternate form of the ListSecurityGroupTargets method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, + "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { + for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24300,14 +24917,11 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPNGatewayConnectionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNGatewayConnectionsOptions.Start)) - } - if listVPNGatewayConnectionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNGatewayConnectionsOptions.Limit)) + if listSecurityGroupTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) } - if listVPNGatewayConnectionsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) + if listSecurityGroupTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) } request, err := builder.Build() @@ -24319,12 +24933,12 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_gateway_connections", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_security_group_targets", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24335,129 +24949,125 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list return } -// CreateVPNGatewayConnection : Create a connection for a VPN gateway -// This request creates a new VPN gateway connection. -func (vpc *VpcV1) CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) +// DeleteSecurityGroupTargetBinding : Remove a target from a security group +// This request removes a target from a security group. For this request to succeed, the target must be attached to at +// least one other security group. The specified target identifier can be: +// +// - A bare metal server network interface identifier +// - A virtual network interface identifier +// - A VPN server identifier +// - A load balancer identifier +// - An endpoint gateway identifier +// - An instance network interface identifier +// +// Security groups are stateful, so any changes to a target's security groups are applied to new connections. Existing +// connections are not affected. +func (vpc *VpcV1) DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPNGatewayConnectionWithContext is an alternate form of the CreateVPNGatewayConnection method which supports a Context parameter -func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions cannot be nil") +// DeleteSecurityGroupTargetBindingWithContext is an alternate form of the DeleteSecurityGroupTargetBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Context, deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_vpn_gateway_connection", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_security_group_target_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// DeleteVPNGatewayConnection : Delete a VPN gateway connection -// This request deletes a VPN gateway connection. This operation cannot be reversed. For this request to succeed, there -// must not be VPC routes using this VPN connection as a next hop. -func (vpc *VpcV1) DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) +// GetSecurityGroupTarget : Retrieve a security group target +// This request retrieves a single target specified by the identifier in the URL path. The target must be an existing +// target of the security group. +func (vpc *VpcV1) GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPNGatewayConnectionWithContext is an alternate form of the DeleteVPNGatewayConnection method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions cannot be nil") +// GetSecurityGroupTargetWithContext is an alternate form of the GetSecurityGroupTarget method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, - "id": *deleteVPNGatewayConnectionOptions.ID, + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -24468,56 +25078,75 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpn_gateway_connection", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_security_group_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetVPNGatewayConnection : Retrieve a VPN gateway connection -// This request retrieves a single VPN gateway connection specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPNGatewayConnectionWithContext is an alternate form of the GetVPNGatewayConnection method which supports a Context parameter -func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions cannot be nil") +// CreateSecurityGroupTargetBinding : Add a target to a security group +// This request adds a resource to an existing security group. The specified target identifier can be: +// +// - A bare metal server network interface identifier +// - A virtual network interface identifier +// - A VPN server identifier +// - A load balancer identifier +// - An endpoint gateway identifier +// - An instance network interface identifier +// +// When a target is added to a security group, the security group rules are applied to the target. A request body is not +// required, and if provided, is ignored. +func (vpc *VpcV1) CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateSecurityGroupTargetBindingWithContext is an alternate form of the CreateSecurityGroupTargetBinding method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Context, createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, - "id": *getVPNGatewayConnectionOptions.ID, + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24535,12 +25164,12 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_gateway_connection", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_security_group_target_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24551,59 +25180,48 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN return } -// UpdateVPNGatewayConnection : Update a VPN gateway connection -// This request updates the properties of an existing VPN gateway connection. -func (vpc *VpcV1) UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) +// ListIkePolicies : List IKE policies +// This request lists IKE policies in the region. +func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPNGatewayConnectionWithContext is an alternate form of the UpdateVPNGatewayConnection method which supports a Context parameter -func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") +// ListIkePoliciesWithContext is an alternate form of the ListIkePolicies method which supports a Context parameter +func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listIkePoliciesOptions, "listIkePoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, - "id": *updateVPNGatewayConnectionOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range listIkePoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - - _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listIkePoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) + } + if listIkePoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIkePoliciesOptions.Limit)) } request, err := builder.Build() @@ -24615,12 +25233,12 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpn_gateway_connection", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_ike_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24631,56 +25249,78 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd return } -// ListVPNGatewayConnectionsLocalCIDRs : List local CIDRs for a VPN gateway connection -// This request lists local CIDRs for a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRs(listVPNGatewayConnectionsLocalCIDRsOptions *ListVPNGatewayConnectionsLocalCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewayConnectionsLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionsLocalCIDRsOptions) +// CreateIkePolicy : Create an IKE policy +// This request creates a new IKE policy. +func (vpc *VpcV1) CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPNGatewayConnectionsLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionsLocalCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionsLocalCIDRsOptions *ListVPNGatewayConnectionsLocalCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions cannot be nil") +// CreateIkePolicyWithContext is an alternate form of the CreateIkePolicy method which supports a Context parameter +func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIkePolicyOptions, "createIkePolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") + err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionsLocalCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionsLocalCIDRsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { + for headerName, headerValue := range createIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + body := make(map[string]interface{}) + if createIkePolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIkePolicyOptions.AuthenticationAlgorithm + } + if createIkePolicyOptions.DhGroup != nil { + body["dh_group"] = createIkePolicyOptions.DhGroup + } + if createIkePolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIkePolicyOptions.EncryptionAlgorithm + } + if createIkePolicyOptions.IkeVersion != nil { + body["ike_version"] = createIkePolicyOptions.IkeVersion + } + if createIkePolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIkePolicyOptions.KeyLifetime + } + if createIkePolicyOptions.Name != nil { + body["name"] = createIkePolicyOptions.Name + } + if createIkePolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIkePolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -24690,12 +25330,12 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_gateway_connections_local_cidrs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_ike_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24706,49 +25346,46 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Con return } -// RemoveVPNGatewayConnectionsLocalCIDR : Remove a local CIDR from a VPN gateway connection -// This request removes a CIDR from a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDR(removeVPNGatewayConnectionsLocalCIDROptions *RemoveVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionsLocalCIDROptions) +// DeleteIkePolicy : Delete an IKE policy +// This request deletes an IKE policy. This operation cannot be reversed. For this request to succeed, there must not be +// any VPN gateway connections using this policy. +func (vpc *VpcV1) DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionsLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionsLocalCIDROptions *RemoveVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions cannot be nil") +// DeleteIkePolicyWithContext is an alternate form of the DeleteIkePolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteIkePolicyOptions, "deleteIkePolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") + err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionsLocalCIDROptions.ID, - "cidr": *removeVPNGatewayConnectionsLocalCIDROptions.CIDR, + "id": *deleteIkePolicyOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers { + for headerName, headerValue := range deleteIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24764,7 +25401,7 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Co response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_ike_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -24772,52 +25409,49 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Co return } -// CheckVPNGatewayConnectionsLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection -// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDR(checkVPNGatewayConnectionsLocalCIDROptions *CheckVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.CheckVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionsLocalCIDROptions) +// GetIkePolicy : Retrieve an IKE policy +// This request retrieves a single IKE policy specified by the identifier in the URL. +func (vpc *VpcV1) GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// CheckVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionsLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionsLocalCIDROptions *CheckVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions cannot be nil") +// GetIkePolicyWithContext is an alternate form of the GetIkePolicy method which supports a Context parameter +func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIkePolicyOptions, "getIkePolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") + err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionsLocalCIDROptions.ID, - "cidr": *checkVPNGatewayConnectionsLocalCIDROptions.CIDR, + "id": *getIkePolicyOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { + for headerName, headerValue := range getIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -24828,125 +25462,143 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Con return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_ike_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// AddVPNGatewayConnectionsLocalCIDR : Set a local CIDR on a VPN gateway connection -// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified -// CIDR already exists. A request body is not required, and if provided, is ignored. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDR(addVPNGatewayConnectionsLocalCIDROptions *AddVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.AddVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionsLocalCIDROptions) +// UpdateIkePolicy : Update an IKE policy +// This request updates the properties of an existing IKE policy. +func (vpc *VpcV1) UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionsLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionsLocalCIDROptions *AddVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions cannot be nil") +// UpdateIkePolicyWithContext is an alternate form of the UpdateIkePolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIkePolicyOptions, "updateIkePolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionsLocalCIDROptions.ID, - "cidr": *addVPNGatewayConnectionsLocalCIDROptions.CIDR, + "id": *updateIkePolicyOptions.ID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers { + for headerName, headerValue := range updateIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_ike_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// ListVPNGatewayConnectionsPeerCIDRs : List peer CIDRs for a VPN gateway connection -// This request lists peer CIDRs for a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRs(listVPNGatewayConnectionsPeerCIDRsOptions *ListVPNGatewayConnectionsPeerCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewayConnectionsPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionsPeerCIDRsOptions) +// ListIkePolicyConnections : List VPN gateway connections that use a specified IKE policy +// This request lists VPN gateway connections that use a IKE policy. +func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *IkePolicyConnectionCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPNGatewayConnectionsPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionsPeerCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionsPeerCIDRsOptions *ListVPNGatewayConnectionsPeerCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions cannot be nil") +// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *IkePolicyConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") + err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionsPeerCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionsPeerCIDRsOptions.ID, + "id": *listIkePolicyConnectionsOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24954,6 +25606,12 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Cont builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listIkePolicyConnectionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIkePolicyConnectionsOptions.Start)) + } + if listIkePolicyConnectionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIkePolicyConnectionsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -24964,12 +25622,12 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_gateway_connections_peer_cidrs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_ike_policy_connections", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyConnectionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24980,55 +25638,49 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Cont return } -// RemoveVPNGatewayConnectionsPeerCIDR : Remove a peer CIDR from a VPN gateway connection -// This request removes a CIDR from a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDR(removeVPNGatewayConnectionsPeerCIDROptions *RemoveVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionsPeerCIDROptions) +// ListIpsecPolicies : List IPsec policies +// This request lists IPsec policies in the region. +func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionsPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionsPeerCIDROptions *RemoveVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions") +// ListIpsecPoliciesWithContext is an alternate form of the ListIpsecPolicies method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listIpsecPoliciesOptions, "listIpsecPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionsPeerCIDROptions.ID, - "cidr": *removeVPNGatewayConnectionsPeerCIDROptions.CIDR, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listIpsecPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) + } + if listIpsecPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -25036,126 +25688,159 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Con return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_ipsec_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// CheckVPNGatewayConnectionsPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection -// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDR(checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions) +// CreateIpsecPolicy : Create an IPsec policy +// This request creates a new IPsec policy. +func (vpc *VpcV1) CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// CheckVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionsPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions cannot be nil") +// CreateIpsecPolicyWithContext is an alternate form of the CreateIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIpsecPolicyOptions, "createIpsecPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") + err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionsPeerCIDROptions.ID, - "cidr": *checkVPNGatewayConnectionsPeerCIDROptions.CIDR, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { + for headerName, headerValue := range createIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + body := make(map[string]interface{}) + if createIpsecPolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIpsecPolicyOptions.AuthenticationAlgorithm + } + if createIpsecPolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIpsecPolicyOptions.EncryptionAlgorithm + } + if createIpsecPolicyOptions.Pfs != nil { + body["pfs"] = createIpsecPolicyOptions.Pfs + } + if createIpsecPolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIpsecPolicyOptions.KeyLifetime + } + if createIpsecPolicyOptions.Name != nil { + body["name"] = createIpsecPolicyOptions.Name + } + if createIpsecPolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIpsecPolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_ipsec_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// AddVPNGatewayConnectionsPeerCIDR : Set a peer CIDR on a VPN gateway connection -// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified -// CIDR already exists. A request body is not required, and if provided, is ignored. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDR(addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions) +// DeleteIpsecPolicy : Delete an IPsec policy +// This request deletes an IPsec policy. This operation cannot be reversed. For this request to succeed, there must not +// be any VPN gateway connections using this policy. +func (vpc *VpcV1) DeleteIpsecPolicy(deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionsPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions cannot be nil") +// DeleteIpsecPolicyWithContext is an alternate form of the DeleteIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionsPeerCIDROptions.ID, - "cidr": *addVPNGatewayConnectionsPeerCIDROptions.CIDR, + "id": *deleteIpsecPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25171,7 +25856,7 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Contex response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_ipsec_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25179,36 +25864,45 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Contex return } -// ListVPNServers : List VPN servers -// This request lists VPN servers. -func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) +// GetIpsecPolicy : Retrieve an IPsec policy +// This request retrieves a single IPsec policy specified by the identifier in the URL. +func (vpc *VpcV1) GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPNServersWithContext is an alternate form of the ListVPNServers method which supports a Context parameter -func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVPNServersOptions, "listVPNServersOptions") +// GetIpsecPolicyWithContext is an alternate form of the GetIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIpsecPolicyOptions, "getIpsecPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getIpsecPolicyOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNServersOptions.Headers { + for headerName, headerValue := range getIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25216,21 +25910,6 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPNServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) - } - if listVPNServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) - } - if listVPNServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) - } - if listVPNServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) - } - if listVPNServersOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -25241,12 +25920,12 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_servers", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_ipsec_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25257,88 +25936,55 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO return } -// CreateVPNServer : Create a VPN server -// This request creates a new VPN server. -func (vpc *VpcV1) CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) +// UpdateIpsecPolicy : Update an IPsec policy +// This request updates the properties of an existing IPsec policy. +func (vpc *VpcV1) UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPNServerWithContext is an alternate form of the CreateVPNServer method which supports a Context parameter -func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNServerOptions, "createVPNServerOptions cannot be nil") +// UpdateIpsecPolicyWithContext is an alternate form of the UpdateIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIpsecPolicyOptions, "updateIpsecPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNServerOptions.Headers { + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createVPNServerOptions.Certificate != nil { - body["certificate"] = createVPNServerOptions.Certificate - } - if createVPNServerOptions.ClientAuthentication != nil { - body["client_authentication"] = createVPNServerOptions.ClientAuthentication - } - if createVPNServerOptions.ClientIPPool != nil { - body["client_ip_pool"] = createVPNServerOptions.ClientIPPool - } - if createVPNServerOptions.Subnets != nil { - body["subnets"] = createVPNServerOptions.Subnets - } - if createVPNServerOptions.ClientDnsServerIps != nil { - body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps - } - if createVPNServerOptions.ClientIdleTimeout != nil { - body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout - } - if createVPNServerOptions.EnableSplitTunneling != nil { - body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling - } - if createVPNServerOptions.Name != nil { - body["name"] = createVPNServerOptions.Name - } - if createVPNServerOptions.Port != nil { - body["port"] = createVPNServerOptions.Port - } - if createVPNServerOptions.Protocol != nil { - body["protocol"] = createVPNServerOptions.Protocol - } - if createVPNServerOptions.ResourceGroup != nil { - body["resource_group"] = createVPNServerOptions.ResourceGroup - } - if createVPNServerOptions.SecurityGroups != nil { - body["security_groups"] = createVPNServerOptions.SecurityGroups - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -25353,12 +25999,12 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpn_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_ipsec_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25369,54 +26015,58 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe return } -// DeleteVPNServer : Delete a VPN server -// This request deletes a VPN server. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) +// ListIpsecPolicyConnections : List VPN gateway connections that use a specified IPsec policy +// This request lists VPN gateway connections that use a IPsec policy. +func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *IPsecPolicyConnectionCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPNServerWithContext is an alternate form of the DeleteVPNServer method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNServerOptions, "deleteVPNServerOptions cannot be nil") +// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *IPsecPolicyConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVPNServerOptions.ID, + "id": *listIpsecPolicyConnectionsOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}/connections`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPNServerOptions.Headers { + for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVPNServerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNServerOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listIpsecPolicyConnectionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Start)) + } + if listIpsecPolicyConnectionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -25424,55 +26074,55 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpn_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_ipsec_policy_connections", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyConnectionCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetVPNServer : Retrieve a VPN server -// This request retrieves a single VPN server specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNServer(getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) +// ListVPNGateways : List VPN gateways +// This request lists VPN gateways in the region. +func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPNServerWithContext is an alternate form of the GetVPNServer method which supports a Context parameter -func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNServerOptions, "getVPNServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") +// ListVPNGatewaysWithContext is an alternate form of the ListVPNGateways method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVPNGatewaysOptions, "listVPNGatewaysOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getVPNServerOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNServerOptions.Headers { + for headerName, headerValue := range listVPNGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25480,6 +26130,21 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVPNGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) + } + if listVPNGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) + } + if listVPNGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) + } + if listVPNGatewaysOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) + } + if listVPNGatewaysOptions.Mode != nil { + builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) + } request, err := builder.Build() if err != nil { @@ -25490,12 +26155,12 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpn_gateways", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25506,59 +26171,51 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio return } -// UpdateVPNServer : Update a VPN server -// This request updates the properties of an existing VPN server. Any updates other than to `name` will cause all -// connected VPN clients to be disconnected. -func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) +// CreateVPNGateway : Create a VPN gateway +// This request creates a new VPN gateway. +func (vpc *VpcV1) CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPNServerWithContext is an alternate form of the UpdateVPNServer method which supports a Context parameter -func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPNServerOptions, "updateVPNServerOptions cannot be nil") +// CreateVPNGatewayWithContext is an alternate form of the CreateVPNGateway method which supports a Context parameter +func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNGatewayOptions, "createVPNGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *updateVPNServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNServerOptions.Headers { + for headerName, headerValue := range createVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPNServerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPNServerOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -25573,12 +26230,12 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpn_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpn_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25589,50 +26246,50 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe return } -// GetVPNServerClientConfiguration : Retrieve client configuration -// This request retrieves OpenVPN client configuration on a single VPN server specified by the identifier in the URL. -// This configuration includes directives compatible with OpenVPN releases 2.4 and 2.5. -func (vpc *VpcV1) GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) +// DeleteVPNGateway : Delete a VPN gateway +// This request deletes a VPN gateway. This operation cannot be reversed. For this request to succeed, the VPN gateway +// must not have a `status` of `pending`, and there must not be any VPC routes using the VPN gateway's connections as a +// next hop. +func (vpc *VpcV1) DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPNServerClientConfigurationWithContext is an alternate form of the GetVPNServerClientConfiguration method which supports a Context parameter -func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context, getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions cannot be nil") +// DeleteVPNGatewayWithContext is an alternate form of the DeleteVPNGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNGatewayOptions, "deleteVPNGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNServerClientConfigurationOptions.ID, + "id": *deleteVPNGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { + for headerName, headerValue := range deleteVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -25643,9 +26300,9 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context return } - response, err = vpc.Service.Request(request, &result) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25653,46 +26310,45 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context return } -// ListVPNServerClients : List VPN clients for a VPN server -// This request retrieves connected VPN clients, and any disconnected VPN clients that the VPN server has not yet -// deleted based on its auto-deletion policy. -func (vpc *VpcV1) ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) +// GetVPNGateway : Retrieve a VPN gateway +// This request retrieves a single VPN gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPNServerClientsWithContext is an alternate form of the ListVPNServerClients method which supports a Context parameter -func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNServerClientsOptions, "listVPNServerClientsOptions cannot be nil") +// GetVPNGatewayWithContext is an alternate form of the GetVPNGateway method which supports a Context parameter +func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNGatewayOptions, "getVPNGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, + "id": *getVPNGatewayOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNServerClientsOptions.Headers { + for headerName, headerValue := range getVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25700,15 +26356,6 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPNServerClientsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) - } - if listVPNServerClientsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) - } - if listVPNServerClientsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -25719,12 +26366,12 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_server_clients", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpn_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25735,111 +26382,124 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe return } -// DeleteVPNServerClient : Delete a VPN client -// This request disconnects and deletes the VPN client from the VPN server. The VPN client may reconnect unless its -// authentication permissions for the configured authentication methods (such as its client certificate) have been -// revoked. -func (vpc *VpcV1) DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) +// UpdateVPNGateway : Update a VPN gateway +// This request updates the properties of an existing VPN gateway. +func (vpc *VpcV1) UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPNServerClientWithContext is an alternate form of the DeleteVPNServerClient method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNServerClientOptions, "deleteVPNServerClientOptions cannot be nil") +// UpdateVPNGatewayWithContext is an alternate form of the UpdateVPNGateway method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNGatewayOptions, "updateVPNGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, - "id": *deleteVPNServerClientOptions.ID, + "id": *updateVPNGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPNServerClientOptions.Headers { + for headerName, headerValue := range updateVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpn_server_client", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpn_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetVPNServerClient : Retrieve a VPN client -// This request retrieves a single VPN client specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) +// ListVPNGatewayConnections : List connections of a VPN gateway +// This request lists connections of a VPN gateway. +func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPNServerClientWithContext is an alternate form of the GetVPNServerClient method which supports a Context parameter -func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNServerClientOptions, "getVPNServerClientOptions cannot be nil") +// ListVPNGatewayConnectionsWithContext is an alternate form of the ListVPNGatewayConnections method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *getVPNServerClientOptions.VPNServerID, - "id": *getVPNServerClientOptions.ID, + "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNServerClientOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25847,6 +26507,15 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVPNGatewayConnectionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNGatewayConnectionsOptions.Start)) + } + if listVPNGatewayConnectionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNGatewayConnectionsOptions.Limit)) + } + if listVPNGatewayConnectionsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) + } request, err := builder.Build() if err != nil { @@ -25857,12 +26526,12 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_server_client", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpn_gateway_connections", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25873,128 +26542,132 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe return } -// DisconnectVPNClient : Disconnect a VPN client -// This request disconnects the specified VPN client, and deletes the client according to the VPN server's auto-deletion -// policy. The VPN client may reconnect unless its authentication permissions for the configured authentication methods -// (such as its client certificate) have been revoked. -func (vpc *VpcV1) DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) +// CreateVPNGatewayConnection : Create a connection for a VPN gateway +// This request creates a new VPN gateway connection. +func (vpc *VpcV1) CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) err = core.RepurposeSDKProblem(err, "") return } -// DisconnectVPNClientWithContext is an alternate form of the DisconnectVPNClient method which supports a Context parameter -func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(disconnectVPNClientOptions, "disconnectVPNClientOptions cannot be nil") +// CreateVPNGatewayConnectionWithContext is an alternate form of the CreateVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, - "id": *disconnectVPNClientOptions.ID, + "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range disconnectVPNClientOptions.Headers { + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "disconnect_vpn_client", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpn_gateway_connection", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// ListVPNServerRoutes : List VPN routes for a VPN server -// This request lists VPN routes in a VPN server. All VPN routes are provided to the VPN client when the connection is -// established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN route -// matching their specified destinations. All VPN routes must be unique within the VPN server. -func (vpc *VpcV1) ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) +// DeleteVPNGatewayConnection : Delete a VPN gateway connection +// This request deletes a VPN gateway connection. This operation cannot be reversed. For this request to succeed, there +// must not be VPC routes using this VPN connection as a next hop. +func (vpc *VpcV1) DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPNServerRoutesWithContext is an alternate form of the ListVPNServerRoutes method which supports a Context parameter -func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNServerRoutesOptions, "listVPNServerRoutesOptions cannot be nil") +// DeleteVPNGatewayConnectionWithContext is an alternate form of the DeleteVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, + "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, + "id": *deleteVPNGatewayConnectionOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNServerRoutesOptions.Headers { + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPNServerRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) - } - if listVPNServerRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServerRoutesOptions.Limit)) - } - if listVPNServerRoutesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServerRoutesOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -26002,91 +26675,64 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_server_routes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_gateway_connection", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateVPNServerRoute : Create a VPN route for a VPN server -// This request creates a new VPN route in the VPN server. All VPN routes are provided to the VPN client when the -// connection is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN -// route matching their specified destinations. All VPN routes must be unique within the VPN server. -func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) +// GetVPNGatewayConnection : Retrieve a VPN gateway connection +// This request retrieves a single VPN gateway connection specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPNServerRouteWithContext is an alternate form of the CreateVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNServerRouteOptions, "createVPNServerRouteOptions cannot be nil") +// GetVPNGatewayConnectionWithContext is an alternate form of the GetVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") + err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, + "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getVPNGatewayConnectionOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNServerRouteOptions.Headers { + for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createVPNServerRouteOptions.Destination != nil { - body["destination"] = createVPNServerRouteOptions.Destination - } - if createVPNServerRouteOptions.Action != nil { - body["action"] = createVPNServerRouteOptions.Action - } - if createVPNServerRouteOptions.Name != nil { - body["name"] = createVPNServerRouteOptions.Name - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -26096,12 +26742,12 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpn_server_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpn_gateway_connection", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26112,117 +26758,61 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN return } -// DeleteVPNServerRoute : Delete a VPN route -// This request deletes a VPN route. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) +// UpdateVPNGatewayConnection : Update a VPN gateway connection +// This request updates the properties of an existing VPN gateway connection. +func (vpc *VpcV1) UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPNServerRouteWithContext is an alternate form of the DeleteVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions cannot be nil") +// UpdateVPNGatewayConnectionWithContext is an alternate form of the UpdateVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, - "id": *deleteVPNServerRouteOptions.ID, + "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, + "id": *updateVPNGatewayConnectionOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return - } - - response, err = vpc.Service.Request(request, nil) - if err != nil { - core.EnrichHTTPProblem(err, "delete_vpn_server_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetVPNServerRoute : Retrieve a VPN route -// This request retrieves a single VPN route specified by the identifier in the URL. -func (vpc *VpcV1) GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPNServerRouteWithContext is an alternate form of the GetVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNServerRouteOptions, "getVPNServerRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *getVPNServerRouteOptions.VPNServerID, - "id": *getVPNServerRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -26232,12 +26822,12 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_server_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpn_gateway_connection", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26248,62 +26838,56 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer return } -// UpdateVPNServerRoute : Update a VPN route -// This request updates a VPN route with the information in a provided VPN route patch. The VPN route patch object is -// structured in the same way as a retrieved VPN route and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) +// ListVPNGatewayConnectionsLocalCIDRs : List local CIDRs for a VPN gateway connection +// This request lists local CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRs(listVPNGatewayConnectionsLocalCIDRsOptions *ListVPNGatewayConnectionsLocalCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNGatewayConnectionsLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionsLocalCIDRsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPNServerRouteWithContext is an alternate form of the UpdateVPNServerRoute method which supports a Context parameter -func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPNServerRouteOptions, "updateVPNServerRouteOptions cannot be nil") +// ListVPNGatewayConnectionsLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionsLocalCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionsLocalCIDRsOptions *ListVPNGatewayConnectionsLocalCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *updateVPNServerRouteOptions.VPNServerID, - "id": *updateVPNServerRouteOptions.ID, + "vpn_gateway_id": *listVPNGatewayConnectionsLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionsLocalCIDRsOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -26313,12 +26897,12 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpn_server_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpn_gateway_connections_local_cidrs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26329,50 +26913,55 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN return } -// ListLoadBalancerProfiles : List load balancer profiles -// This request lists load balancer profiles available in the region. A load balancer profile specifies the performance -// characteristics and pricing model for a load balancer. -func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +// RemoveVPNGatewayConnectionsLocalCIDR : Remove a local CIDR from a VPN gateway connection +// This request removes a CIDR from a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDR(removeVPNGatewayConnectionsLocalCIDROptions *RemoveVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionsLocalCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// ListLoadBalancerProfilesWithContext is an alternate form of the ListLoadBalancerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listLoadBalancerProfilesOptions, "listLoadBalancerProfilesOptions") +// RemoveVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionsLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionsLocalCIDROptions *RemoveVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "vpn_gateway_id": *removeVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionsLocalCIDROptions.ID, + "cidr": *removeVPNGatewayConnectionsLocalCIDROptions.CIDR, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listLoadBalancerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) - } - if listLoadBalancerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -26380,68 +26969,62 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetLoadBalancerProfile : Retrieve a load balancer profile -// This request retrieves a load balancer profile specified by the name in the URL. -func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) +// CheckVPNGatewayConnectionsLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection +// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDR(checkVPNGatewayConnectionsLocalCIDROptions *CheckVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.CheckVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionsLocalCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// GetLoadBalancerProfileWithContext is an alternate form of the GetLoadBalancerProfile method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions cannot be nil") +// CheckVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionsLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionsLocalCIDROptions *CheckVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, + "vpn_gateway_id": *checkVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionsLocalCIDROptions.ID, + "cidr": *checkVPNGatewayConnectionsLocalCIDROptions.CIDR, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -26452,68 +27035,66 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_profile", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListLoadBalancers : List load balancers -// This request lists load balancers in the region. -func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) +// AddVPNGatewayConnectionsLocalCIDR : Set a local CIDR on a VPN gateway connection +// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified +// CIDR already exists. A request body is not required, and if provided, is ignored. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDR(addVPNGatewayConnectionsLocalCIDROptions *AddVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.AddVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionsLocalCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// ListLoadBalancersWithContext is an alternate form of the ListLoadBalancers method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listLoadBalancersOptions, "listLoadBalancersOptions") +// AddVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionsLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionsLocalCIDROptions *AddVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionsLocalCIDROptions.ID, + "cidr": *addVPNGatewayConnectionsLocalCIDROptions.CIDR, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listLoadBalancersOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listLoadBalancersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) - } - if listLoadBalancersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -26521,112 +27102,66 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancers", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateLoadBalancer : Create a load balancer -// This request creates and provisions a new load balancer. -func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) +// ListVPNGatewayConnectionsPeerCIDRs : List peer CIDRs for a VPN gateway connection +// This request lists peer CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRs(listVPNGatewayConnectionsPeerCIDRsOptions *ListVPNGatewayConnectionsPeerCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNGatewayConnectionsPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionsPeerCIDRsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateLoadBalancerWithContext is an alternate form of the CreateLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerOptions, "createLoadBalancerOptions cannot be nil") +// ListVPNGatewayConnectionsPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionsPeerCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionsPeerCIDRsOptions *ListVPNGatewayConnectionsPeerCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionsPeerCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionsPeerCIDRsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createLoadBalancerOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createLoadBalancerOptions.IsPublic != nil { - body["is_public"] = createLoadBalancerOptions.IsPublic - } - if createLoadBalancerOptions.Subnets != nil { - body["subnets"] = createLoadBalancerOptions.Subnets - } - if createLoadBalancerOptions.Dns != nil { - body["dns"] = createLoadBalancerOptions.Dns - } - if createLoadBalancerOptions.IsPrivatePath != nil { - body["is_private_path"] = createLoadBalancerOptions.IsPrivatePath - } - if createLoadBalancerOptions.Listeners != nil { - body["listeners"] = createLoadBalancerOptions.Listeners - } - if createLoadBalancerOptions.Logging != nil { - body["logging"] = createLoadBalancerOptions.Logging - } - if createLoadBalancerOptions.Name != nil { - body["name"] = createLoadBalancerOptions.Name - } - if createLoadBalancerOptions.Pools != nil { - body["pools"] = createLoadBalancerOptions.Pools - } - if createLoadBalancerOptions.Profile != nil { - body["profile"] = createLoadBalancerOptions.Profile - } - if createLoadBalancerOptions.ResourceGroup != nil { - body["resource_group"] = createLoadBalancerOptions.ResourceGroup - } - if createLoadBalancerOptions.RouteMode != nil { - body["route_mode"] = createLoadBalancerOptions.RouteMode - } - if createLoadBalancerOptions.SecurityGroups != nil { - body["security_groups"] = createLoadBalancerOptions.SecurityGroups - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -26636,12 +27171,12 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_load_balancer", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpn_gateway_connections_peer_cidrs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26652,52 +27187,52 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB return } -// DeleteLoadBalancer : Delete a load balancer -// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its -// `provisioning_status` is `delete_pending` or it is referenced by a resource. -func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) +// RemoveVPNGatewayConnectionsPeerCIDR : Remove a peer CIDR from a VPN gateway connection +// This request removes a CIDR from a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDR(removeVPNGatewayConnectionsPeerCIDROptions *RemoveVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionsPeerCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteLoadBalancerWithContext is an alternate form of the DeleteLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerOptions, "deleteLoadBalancerOptions cannot be nil") +// RemoveVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionsPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionsPeerCIDROptions *RemoveVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + err = core.ValidateStruct(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteLoadBalancerOptions.ID, + "vpn_gateway_id": *removeVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionsPeerCIDROptions.ID, + "cidr": *removeVPNGatewayConnectionsPeerCIDROptions.CIDR, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -26710,7 +27245,7 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_load_balancer", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -26718,49 +27253,52 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB return } -// GetLoadBalancer : Retrieve a load balancer -// This request retrieves a single load balancer specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) +// CheckVPNGatewayConnectionsPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection +// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDR(checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// GetLoadBalancerWithContext is an alternate form of the GetLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerOptions, "getLoadBalancerOptions cannot be nil") +// CheckVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionsPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerOptions.ID, + "vpn_gateway_id": *checkVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionsPeerCIDROptions.ID, + "cidr": *checkVPNGatewayConnectionsPeerCIDROptions.CIDR, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -26771,148 +27309,113 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateLoadBalancer : Update a load balancer -// This request updates a load balancer with the information in a provided load balancer patch. The load balancer patch -// object is structured in the same way as a retrieved load balancer and contains only the information to be updated. A -// load balancer can only be updated if its `provisioning_status` is `active`. -func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) +// AddVPNGatewayConnectionsPeerCIDR : Set a peer CIDR on a VPN gateway connection +// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified +// CIDR already exists. A request body is not required, and if provided, is ignored. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDR(addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateLoadBalancerWithContext is an alternate form of the UpdateLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerOptions, "updateLoadBalancerOptions cannot be nil") +// AddVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionsPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") + err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateLoadBalancerOptions.ID, + "vpn_gateway_id": *addVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionsPeerCIDROptions.ID, + "cidr": *addVPNGatewayConnectionsPeerCIDROptions.CIDR, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateLoadBalancerOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateLoadBalancerOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetLoadBalancerStatistics : List statistics of a load balancer -// This request lists statistics of a load balancer. -func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) +// ListVPNServers : List VPN servers +// This request lists VPN servers. +func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetLoadBalancerStatisticsWithContext is an alternate form of the GetLoadBalancerStatistics method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") +// ListVPNServersWithContext is an alternate form of the ListVPNServers method which supports a Context parameter +func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVPNServersOptions, "listVPNServersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getLoadBalancerStatisticsOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { + for headerName, headerValue := range listVPNServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -26920,78 +27423,21 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_statistics", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerListeners : List listeners for a load balancer -// This request lists listeners for a load balancer. -func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListLoadBalancerListenersWithContext is an alternate form of the ListLoadBalancerListeners method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + if listVPNServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) } - - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + if listVPNServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return + if listVPNServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) } - - for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { - builder.AddHeader(headerName, headerValue) + if listVPNServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if listVPNServersOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -27002,12 +27448,12 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_listeners", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpn_servers", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27018,45 +27464,41 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list return } -// CreateLoadBalancerListener : Create a listener for a load balancer -// This request creates a new listener for a load balancer. -func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) +// CreateVPNServer : Create a VPN server +// This request creates a new VPN server. +func (vpc *VpcV1) CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateLoadBalancerListenerWithContext is an alternate form of the CreateLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions cannot be nil") +// CreateVPNServerWithContext is an alternate form of the CreateVPNServer method which supports a Context parameter +func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNServerOptions, "createVPNServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range createVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27067,38 +27509,41 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createLoadBalancerListenerOptions.Protocol != nil { - body["protocol"] = createLoadBalancerListenerOptions.Protocol + if createVPNServerOptions.Certificate != nil { + body["certificate"] = createVPNServerOptions.Certificate } - if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { - body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol + if createVPNServerOptions.ClientAuthentication != nil { + body["client_authentication"] = createVPNServerOptions.ClientAuthentication } - if createLoadBalancerListenerOptions.CertificateInstance != nil { - body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance + if createVPNServerOptions.ClientIPPool != nil { + body["client_ip_pool"] = createVPNServerOptions.ClientIPPool } - if createLoadBalancerListenerOptions.ConnectionLimit != nil { - body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit + if createVPNServerOptions.Subnets != nil { + body["subnets"] = createVPNServerOptions.Subnets } - if createLoadBalancerListenerOptions.DefaultPool != nil { - body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool + if createVPNServerOptions.ClientDnsServerIps != nil { + body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps } - if createLoadBalancerListenerOptions.HTTPSRedirect != nil { - body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect + if createVPNServerOptions.ClientIdleTimeout != nil { + body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout } - if createLoadBalancerListenerOptions.IdleConnectionTimeout != nil { - body["idle_connection_timeout"] = createLoadBalancerListenerOptions.IdleConnectionTimeout + if createVPNServerOptions.EnableSplitTunneling != nil { + body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling } - if createLoadBalancerListenerOptions.Policies != nil { - body["policies"] = createLoadBalancerListenerOptions.Policies + if createVPNServerOptions.Name != nil { + body["name"] = createVPNServerOptions.Name } - if createLoadBalancerListenerOptions.Port != nil { - body["port"] = createLoadBalancerListenerOptions.Port + if createVPNServerOptions.Port != nil { + body["port"] = createVPNServerOptions.Port } - if createLoadBalancerListenerOptions.PortMax != nil { - body["port_max"] = createLoadBalancerListenerOptions.PortMax + if createVPNServerOptions.Protocol != nil { + body["protocol"] = createVPNServerOptions.Protocol } - if createLoadBalancerListenerOptions.PortMin != nil { - body["port_min"] = createLoadBalancerListenerOptions.PortMin + if createVPNServerOptions.ResourceGroup != nil { + body["resource_group"] = createVPNServerOptions.ResourceGroup + } + if createVPNServerOptions.SecurityGroups != nil { + body["security_groups"] = createVPNServerOptions.SecurityGroups } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -27115,12 +27560,12 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_load_balancer_listener", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpn_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27131,50 +27576,51 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre return } -// DeleteLoadBalancerListener : Delete a load balancer listener -// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the -// listener must not be the target of another load balancer listener. -func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) +// DeleteVPNServer : Delete a VPN server +// This request deletes a VPN server. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteLoadBalancerListenerWithContext is an alternate form of the DeleteLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions cannot be nil") +// DeleteVPNServerWithContext is an alternate form of the DeleteVPNServer method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerOptions, "deleteVPNServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, - "id": *deleteLoadBalancerListenerOptions.ID, + "id": *deleteVPNServerOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + if deleteVPNServerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNServerOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -27187,7 +27633,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_load_balancer_listener", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -27195,46 +27641,45 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del return } -// GetLoadBalancerListener : Retrieve a load balancer listener -// This request retrieves a single listener specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) +// GetVPNServer : Retrieve a VPN server +// This request retrieves a single VPN server specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServer(getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetLoadBalancerListenerWithContext is an alternate form of the GetLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions cannot be nil") +// GetVPNServerWithContext is an alternate form of the GetVPNServer method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerOptions, "getVPNServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, - "id": *getLoadBalancerListenerOptions.ID, + "id": *getVPNServerOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range getVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27252,12 +27697,12 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_listener", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpn_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27268,56 +27713,59 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa return } -// UpdateLoadBalancerListener : Update a load balancer listener -// This request updates a load balancer listener from a listener patch. -func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +// UpdateVPNServer : Update a VPN server +// This request updates the properties of an existing VPN server. Any updates other than to `name` will cause all +// connected VPN clients to be disconnected. +func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateLoadBalancerListenerWithContext is an alternate form of the UpdateLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions cannot be nil") +// UpdateVPNServerWithContext is an alternate form of the UpdateVPNServer method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNServerOptions, "updateVPNServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, - "id": *updateLoadBalancerListenerOptions.ID, + "id": *updateVPNServerOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range updateVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPNServerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPNServerOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -27332,12 +27780,12 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer_listener", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpn_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27348,51 +27796,50 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd return } -// ListLoadBalancerListenerPolicies : List policies for a load balancer listener -// This request lists policies for a load balancer listener. A policy consists of rules to match against each incoming -// request, and an action to apply to the request if a rule matches. -func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) +// GetVPNServerClientConfiguration : Retrieve client configuration +// This request retrieves OpenVPN client configuration on a single VPN server specified by the identifier in the URL. +// This configuration includes directives compatible with OpenVPN releases 2.4 and 2.5. +func (vpc *VpcV1) GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListLoadBalancerListenerPoliciesWithContext is an alternate form of the ListLoadBalancerListenerPolicies method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Context, listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions cannot be nil") +// GetVPNServerClientConfigurationWithContext is an alternate form of the GetVPNServerClientConfiguration method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context, getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, + "id": *getVPNServerClientConfigurationOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -27403,96 +27850,71 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, &result) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_listener_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener -// This request creates a new policy from a load balancer listener policy object. The prototype object is structured in -// the same way as a retrieved policy, and contains the information necessary to create the new policy. For this request -// to succeed, the listener must have a `protocol` of `http` or `https`. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +// ListVPNServerClients : List VPN clients for a VPN server +// This request retrieves connected VPN clients, and any disconnected VPN clients that the VPN server has not yet +// deleted based on its auto-deletion policy. +func (vpc *VpcV1) ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateLoadBalancerListenerPolicyWithContext is an alternate form of the CreateLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Context, createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions cannot be nil") +// ListVPNServerClientsWithContext is an alternate form of the ListVPNServerClients method which supports a Context parameter +func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNServerClientsOptions, "listVPNServerClientsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, + "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range listVPNServerClientsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - - body := make(map[string]interface{}) - if createLoadBalancerListenerPolicyOptions.Action != nil { - body["action"] = createLoadBalancerListenerPolicyOptions.Action - } - if createLoadBalancerListenerPolicyOptions.Priority != nil { - body["priority"] = createLoadBalancerListenerPolicyOptions.Priority - } - if createLoadBalancerListenerPolicyOptions.Name != nil { - body["name"] = createLoadBalancerListenerPolicyOptions.Name - } - if createLoadBalancerListenerPolicyOptions.Rules != nil { - body["rules"] = createLoadBalancerListenerPolicyOptions.Rules + if listVPNServerClientsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) } - if createLoadBalancerListenerPolicyOptions.Target != nil { - body["target"] = createLoadBalancerListenerPolicyOptions.Target + if listVPNServerClientsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVPNServerClientsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) } request, err := builder.Build() @@ -27504,12 +27926,12 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_load_balancer_listener_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpn_server_clients", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27520,47 +27942,48 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } -// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy -// Deletes a policy of the load balancer listener. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +// DeleteVPNServerClient : Delete a VPN client +// This request disconnects and deletes the VPN client from the VPN server. The VPN client may reconnect unless its +// authentication permissions for the configured authentication methods (such as its client certificate) have been +// revoked. +func (vpc *VpcV1) DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteLoadBalancerListenerPolicyWithContext is an alternate form of the DeleteLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions cannot be nil") +// DeleteVPNServerClientWithContext is an alternate form of the DeleteVPNServerClient method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerClientOptions, "deleteVPNServerClientOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, - "id": *deleteLoadBalancerListenerPolicyOptions.ID, + "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, + "id": *deleteVPNServerClientOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range deleteVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27576,7 +27999,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_load_balancer_listener_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_server_client", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -27584,47 +28007,46 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex return } -// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy -// Retrieve a single policy specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +// GetVPNServerClient : Retrieve a VPN client +// This request retrieves a single VPN client specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetLoadBalancerListenerPolicyWithContext is an alternate form of the GetLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions cannot be nil") +// GetVPNServerClientWithContext is an alternate form of the GetVPNServerClient method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerClientOptions, "getVPNServerClientOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, - "id": *getLoadBalancerListenerPolicyOptions.ID, + "vpn_server_id": *getVPNServerClientOptions.VPNServerID, + "id": *getVPNServerClientOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27642,12 +28064,12 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_listener_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpn_server_client", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27658,129 +28080,112 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, return } -// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy -// This request updates a load balancer listener policy with the information in a provided policy patch. The policy -// patch object is structured in the same way as a retrieved policy and contains only the information to be updated. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) +// DisconnectVPNClient : Disconnect a VPN client +// This request disconnects the specified VPN client, and deletes the client according to the VPN server's auto-deletion +// policy. The VPN client may reconnect unless its authentication permissions for the configured authentication methods +// (such as its client certificate) have been revoked. +func (vpc *VpcV1) DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateLoadBalancerListenerPolicyWithContext is an alternate form of the UpdateLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Context, updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions cannot be nil") +// DisconnectVPNClientWithContext is an alternate form of the DisconnectVPNClient method which supports a Context parameter +func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(disconnectVPNClientOptions, "disconnectVPNClientOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, - "id": *updateLoadBalancerListenerPolicyOptions.ID, + "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, + "id": *disconnectVPNClientOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range disconnectVPNClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer_listener_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "disconnect_vpn_client", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListLoadBalancerListenerPolicyRules : List rules of a load balancer listener policy -// This request lists rules of a load balancer listener policy. -func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) +// ListVPNServerRoutes : List VPN routes for a VPN server +// This request lists VPN routes in a VPN server. All VPN routes are provided to the VPN client when the connection is +// established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN route +// matching their specified destinations. All VPN routes must be unique within the VPN server. +func (vpc *VpcV1) ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListLoadBalancerListenerPolicyRulesWithContext is an alternate form of the ListLoadBalancerListenerPolicyRules method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Context, listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions cannot be nil") +// ListVPNServerRoutesWithContext is an alternate form of the ListVPNServerRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNServerRoutesOptions, "listVPNServerRoutesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, - "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27788,6 +28193,15 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVPNServerRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) + } + if listVPNServerRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerRoutesOptions.Limit)) + } + if listVPNServerRoutesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerRoutesOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -27798,12 +28212,12 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_listener_policy_rules", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpn_server_routes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27814,47 +28228,47 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con return } -// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy -// Creates a new rule for the load balancer listener policy. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) +// CreateVPNServerRoute : Create a VPN route for a VPN server +// This request creates a new VPN route in the VPN server. All VPN routes are provided to the VPN client when the +// connection is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN +// route matching their specified destinations. All VPN routes must be unique within the VPN server. +func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the CreateLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions cannot be nil") +// CreateVPNServerRouteWithContext is an alternate form of the CreateVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNServerRouteOptions, "createVPNServerRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range createVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27865,17 +28279,14 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { - body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition - } - if createLoadBalancerListenerPolicyRuleOptions.Type != nil { - body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type + if createVPNServerRouteOptions.Destination != nil { + body["destination"] = createVPNServerRouteOptions.Destination } - if createLoadBalancerListenerPolicyRuleOptions.Value != nil { - body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value + if createVPNServerRouteOptions.Action != nil { + body["action"] = createVPNServerRouteOptions.Action } - if createLoadBalancerListenerPolicyRuleOptions.Field != nil { - body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field + if createVPNServerRouteOptions.Name != nil { + body["name"] = createVPNServerRouteOptions.Name } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -27892,12 +28303,12 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_load_balancer_listener_policy_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpn_server_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27908,48 +28319,46 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } -// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule -// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) +// DeleteVPNServerRoute : Delete a VPN route +// This request deletes a VPN route. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteLoadBalancerListenerPolicyRuleWithContext is an alternate form of the DeleteLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions cannot be nil") +// DeleteVPNServerRouteWithContext is an alternate form of the DeleteVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, + "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, + "id": *deleteVPNServerRouteOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27965,7 +28374,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_load_balancer_listener_policy_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_server_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -27973,48 +28382,46 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } -// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule -// Retrieves a single rule specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) +// GetVPNServerRoute : Retrieve a VPN route +// This request retrieves a single VPN route specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetLoadBalancerListenerPolicyRuleWithContext is an alternate form of the GetLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions cannot be nil") +// GetVPNServerRouteWithContext is an alternate form of the GetVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerRouteOptions, "getVPNServerRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *getLoadBalancerListenerPolicyRuleOptions.ID, + "vpn_server_id": *getVPNServerRouteOptions.VPNServerID, + "id": *getVPNServerRouteOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range getVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28032,12 +28439,12 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_listener_policy_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpn_server_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28048,48 +28455,47 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte return } -// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule -// Updates a rule of the load balancer listener policy. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) +// UpdateVPNServerRoute : Update a VPN route +// This request updates a VPN route with the information in a provided VPN route patch. The VPN route patch object is +// structured in the same way as a retrieved VPN route and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the UpdateLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions cannot be nil") +// UpdateVPNServerRouteWithContext is an alternate form of the UpdateVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNServerRouteOptions, "updateVPNServerRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, + "vpn_server_id": *updateVPNServerRouteOptions.VPNServerID, + "id": *updateVPNServerRouteOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28099,7 +28505,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -28114,12 +28520,12 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer_listener_policy_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpn_server_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28130,45 +28536,115 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } -// ListLoadBalancerPools : List pools of a load balancer -// This request lists pools of a load balancer. -func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) +// ListLoadBalancerProfiles : List load balancer profiles +// This request lists load balancer profiles available in the region. A load balancer profile specifies the performance +// characteristics and pricing model for a load balancer. +func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListLoadBalancerPoolsWithContext is an alternate form of the ListLoadBalancerPools method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions cannot be nil") +// ListLoadBalancerProfilesWithContext is an alternate form of the ListLoadBalancerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancerProfilesOptions, "listLoadBalancerProfilesOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listLoadBalancerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) + } + if listLoadBalancerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_load_balancer_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetLoadBalancerProfile : Retrieve a load balancer profile +// This request retrieves a load balancer profile specified by the name in the URL. +func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetLoadBalancerProfileWithContext is an alternate form of the GetLoadBalancerProfile method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + "name": *getLoadBalancerProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28186,12 +28662,12 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_pools", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_load_balancer_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28202,45 +28678,110 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad return } -// CreateLoadBalancerPool : Create a load balancer pool -// This request creates a new pool from a pool prototype object. -func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) +// ListLoadBalancers : List load balancers +// This request lists load balancers in the region. +func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateLoadBalancerPoolWithContext is an alternate form of the CreateLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions cannot be nil") +// ListLoadBalancersWithContext is an alternate form of the ListLoadBalancers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancersOptions, "listLoadBalancersOptions") if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + for headerName, headerValue := range listLoadBalancersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listLoadBalancersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) + } + if listLoadBalancersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_load_balancers", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// CreateLoadBalancer : Create a load balancer +// This request creates and provisions a new load balancer. +func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateLoadBalancerWithContext is an alternate form of the CreateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerOptions, "createLoadBalancerOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range createLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28251,26 +28792,41 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createLoadBalancerPoolOptions.Algorithm != nil { - body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + if createLoadBalancerOptions.IsPublic != nil { + body["is_public"] = createLoadBalancerOptions.IsPublic } - if createLoadBalancerPoolOptions.HealthMonitor != nil { - body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + if createLoadBalancerOptions.Subnets != nil { + body["subnets"] = createLoadBalancerOptions.Subnets } - if createLoadBalancerPoolOptions.Protocol != nil { - body["protocol"] = createLoadBalancerPoolOptions.Protocol + if createLoadBalancerOptions.Dns != nil { + body["dns"] = createLoadBalancerOptions.Dns } - if createLoadBalancerPoolOptions.Members != nil { - body["members"] = createLoadBalancerPoolOptions.Members + if createLoadBalancerOptions.IsPrivatePath != nil { + body["is_private_path"] = createLoadBalancerOptions.IsPrivatePath } - if createLoadBalancerPoolOptions.Name != nil { - body["name"] = createLoadBalancerPoolOptions.Name + if createLoadBalancerOptions.Listeners != nil { + body["listeners"] = createLoadBalancerOptions.Listeners } - if createLoadBalancerPoolOptions.ProxyProtocol != nil { - body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol + if createLoadBalancerOptions.Logging != nil { + body["logging"] = createLoadBalancerOptions.Logging } - if createLoadBalancerPoolOptions.SessionPersistence != nil { - body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence + if createLoadBalancerOptions.Name != nil { + body["name"] = createLoadBalancerOptions.Name + } + if createLoadBalancerOptions.Pools != nil { + body["pools"] = createLoadBalancerOptions.Pools + } + if createLoadBalancerOptions.Profile != nil { + body["profile"] = createLoadBalancerOptions.Profile + } + if createLoadBalancerOptions.ResourceGroup != nil { + body["resource_group"] = createLoadBalancerOptions.ResourceGroup + } + if createLoadBalancerOptions.RouteMode != nil { + body["route_mode"] = createLoadBalancerOptions.RouteMode + } + if createLoadBalancerOptions.SecurityGroups != nil { + body["security_groups"] = createLoadBalancerOptions.SecurityGroups } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -28287,12 +28843,12 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_load_balancer_pool", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_load_balancer", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28303,50 +28859,52 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL return } -// DeleteLoadBalancerPool : Delete a load balancer pool -// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the -// default pool for any listener in the load balancer. -func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +// DeleteLoadBalancer : Delete a load balancer +// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its +// `provisioning_status` is `delete_pending` or it is referenced by a resource. +func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") +// DeleteLoadBalancerWithContext is an alternate form of the DeleteLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerOptions, "deleteLoadBalancerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, - "id": *deleteLoadBalancerPoolOptions.ID, + "id": *deleteLoadBalancerOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + if deleteLoadBalancerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -28359,7 +28917,7 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_load_balancer_pool", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -28367,46 +28925,45 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL return } -// GetLoadBalancerPool : Retrieve a load balancer pool -// This request retrieves a single pool specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) +// GetLoadBalancer : Retrieve a load balancer +// This request retrieves a single load balancer specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") +// GetLoadBalancerWithContext is an alternate form of the GetLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerOptions, "getLoadBalancerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, - "id": *getLoadBalancerPoolOptions.ID, + "id": *getLoadBalancerOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range getLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28424,12 +28981,12 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_pool", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_load_balancer", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28440,56 +28997,60 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal return } -// UpdateLoadBalancerPool : Update a load balancer pool -// This request updates a load balancer pool from a pool patch. -func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) +// UpdateLoadBalancer : Update a load balancer +// This request updates a load balancer with the information in a provided load balancer patch. The load balancer patch +// object is structured in the same way as a retrieved load balancer and contains only the information to be updated. A +// load balancer can only be updated if its `provisioning_status` is `active`. +func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateLoadBalancerPoolWithContext is an alternate form of the UpdateLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions cannot be nil") +// UpdateLoadBalancerWithContext is an alternate form of the UpdateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerOptions, "updateLoadBalancerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, - "id": *updateLoadBalancerPoolOptions.ID, + "id": *updateLoadBalancerOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range updateLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateLoadBalancerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateLoadBalancerOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -28504,12 +29065,12 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer_pool", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_load_balancer", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28520,46 +29081,45 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL return } -// ListLoadBalancerPoolMembers : List members of a load balancer pool -// This request lists members of a load balancer pool. -func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) +// GetLoadBalancerStatistics : List statistics of a load balancer +// This request lists statistics of a load balancer. +func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListLoadBalancerPoolMembersWithContext is an alternate form of the ListLoadBalancerPoolMembers method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions cannot be nil") +// GetLoadBalancerStatisticsWithContext is an alternate form of the GetLoadBalancerStatistics method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, + "id": *getLoadBalancerStatisticsOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28577,12 +29137,12 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_pool_members", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_load_balancer_statistics", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28593,71 +29153,53 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li return } -// CreateLoadBalancerPoolMember : Create a member in a load balancer pool -// This request creates a new member and adds the member to the pool. -func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +// ListLoadBalancerListeners : List listeners for a load balancer +// This request lists listeners for a load balancer. +func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateLoadBalancerPoolMemberWithContext is an alternate form of the CreateLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions cannot be nil") +// ListLoadBalancerListenersWithContext is an alternate form of the ListLoadBalancerListeners method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createLoadBalancerPoolMemberOptions.Port != nil { - body["port"] = createLoadBalancerPoolMemberOptions.Port - } - if createLoadBalancerPoolMemberOptions.Target != nil { - body["target"] = createLoadBalancerPoolMemberOptions.Target - } - if createLoadBalancerPoolMemberOptions.Weight != nil { - body["weight"] = createLoadBalancerPoolMemberOptions.Weight - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -28667,12 +29209,12 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_load_balancer_pool_member", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_load_balancer_listeners", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28683,47 +29225,45 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c return } -// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members -// This request replaces the existing members of the load balancer pool with new members created from the collection of -// member prototype objects. -func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) +// CreateLoadBalancerListener : Create a listener for a load balancer +// This request creates a new listener for a load balancer. +func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) err = core.RepurposeSDKProblem(err, "") return } -// ReplaceLoadBalancerPoolMembersWithContext is an alternate form of the ReplaceLoadBalancerPoolMembers method which supports a Context parameter -func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions cannot be nil") +// CreateLoadBalancerListenerWithContext is an alternate form of the CreateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, + "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28734,8 +29274,38 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if replaceLoadBalancerPoolMembersOptions.Members != nil { - body["members"] = replaceLoadBalancerPoolMembersOptions.Members + if createLoadBalancerListenerOptions.Protocol != nil { + body["protocol"] = createLoadBalancerListenerOptions.Protocol + } + if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { + body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol + } + if createLoadBalancerListenerOptions.CertificateInstance != nil { + body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance + } + if createLoadBalancerListenerOptions.ConnectionLimit != nil { + body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit + } + if createLoadBalancerListenerOptions.DefaultPool != nil { + body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool + } + if createLoadBalancerListenerOptions.HTTPSRedirect != nil { + body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect + } + if createLoadBalancerListenerOptions.IdleConnectionTimeout != nil { + body["idle_connection_timeout"] = createLoadBalancerListenerOptions.IdleConnectionTimeout + } + if createLoadBalancerListenerOptions.Policies != nil { + body["policies"] = createLoadBalancerListenerOptions.Policies + } + if createLoadBalancerListenerOptions.Port != nil { + body["port"] = createLoadBalancerListenerOptions.Port + } + if createLoadBalancerListenerOptions.PortMax != nil { + body["port_max"] = createLoadBalancerListenerOptions.PortMax + } + if createLoadBalancerListenerOptions.PortMin != nil { + body["port_min"] = createLoadBalancerListenerOptions.PortMin } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -28752,12 +29322,12 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "replace_load_balancer_pool_members", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_load_balancer_listener", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28768,47 +29338,47 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, return } -// DeleteLoadBalancerPoolMember : Delete a load balancer pool member -// This request deletes a member from the pool. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) +// DeleteLoadBalancerListener : Delete a load balancer listener +// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the +// listener must not be the target of another load balancer listener. +func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteLoadBalancerPoolMemberWithContext is an alternate form of the DeleteLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions cannot be nil") +// DeleteLoadBalancerListenerWithContext is an alternate form of the DeleteLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, - "id": *deleteLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, + "id": *deleteLoadBalancerListenerOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28824,7 +29394,7 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_load_balancer_pool_member", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer_listener", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -28832,47 +29402,46 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d return } -// GetLoadBalancerPoolMember : Retrieve a load balancer pool member -// This request retrieves a single member specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) +// GetLoadBalancerListener : Retrieve a load balancer listener +// This request retrieves a single listener specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetLoadBalancerPoolMemberWithContext is an alternate form of the GetLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions cannot be nil") +// GetLoadBalancerListenerWithContext is an alternate form of the GetLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, - "id": *getLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, + "id": *getLoadBalancerListenerOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28890,12 +29459,12 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_pool_member", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_load_balancer_listener", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28906,47 +29475,46 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL return } -// UpdateLoadBalancerPoolMember : Update a load balancer pool member -// This request updates an existing member from a member patch. -func (vpc *VpcV1) UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) +// UpdateLoadBalancerListener : Update a load balancer listener +// This request updates a load balancer listener from a listener patch. +func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateLoadBalancerPoolMemberWithContext is an alternate form of the UpdateLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions cannot be nil") +// UpdateLoadBalancerListenerWithContext is an alternate form of the UpdateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, - "id": *updateLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, + "id": *updateLoadBalancerListenerOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28956,7 +29524,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -28971,12 +29539,12 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer_pool_member", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_load_balancer_listener", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28987,37 +29555,47 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u return } -// ListEndpointGateways : List endpoint gateways -// This request lists endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to a -// target outside the VPC. -func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) +// ListLoadBalancerListenerPolicies : List policies for a load balancer listener +// This request lists policies for a load balancer listener. A policy consists of rules to match against each incoming +// request, and an action to apply to the request if a rule matches. +func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter -func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") +// ListLoadBalancerListenerPoliciesWithContext is an alternate form of the ListLoadBalancerListenerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Context, listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29025,33 +29603,6 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listEndpointGatewaysOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) - } - if listEndpointGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) - } - if listEndpointGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) - } - if listEndpointGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) - } - if listEndpointGatewaysOptions.LifecycleState != nil { - builder.AddQuery("lifecycle_state", strings.Join(listEndpointGatewaysOptions.LifecycleState, ",")) - } - if listEndpointGatewaysOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listEndpointGatewaysOptions.VPCID)) - } - if listEndpointGatewaysOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listEndpointGatewaysOptions.VPCCRN)) - } - if listEndpointGatewaysOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listEndpointGatewaysOptions.VPCName)) - } - if listEndpointGatewaysOptions.AllowDnsResolutionBinding != nil { - builder.AddQuery("allow_dns_resolution_binding", fmt.Sprint(*listEndpointGatewaysOptions.AllowDnsResolutionBinding)) - } request, err := builder.Build() if err != nil { @@ -29062,12 +29613,12 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_endpoint_gateways", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_load_balancer_listener_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29078,42 +29629,48 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo return } -// CreateEndpointGateway : Create an endpoint gateway -// This request creates a new endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target -// outside the VPC. -func (vpc *VpcV1) CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) +// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener +// This request creates a new policy from a load balancer listener policy object. The prototype object is structured in +// the same way as a retrieved policy, and contains the information necessary to create the new policy. For this request +// to succeed, the listener must have a `protocol` of `http` or `https`. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateEndpointGatewayWithContext is an alternate form of the CreateEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createEndpointGatewayOptions, "createEndpointGatewayOptions cannot be nil") +// CreateLoadBalancerListenerPolicyWithContext is an alternate form of the CreateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Context, createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createEndpointGatewayOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29124,26 +29681,20 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createEndpointGatewayOptions.Target != nil { - body["target"] = createEndpointGatewayOptions.Target - } - if createEndpointGatewayOptions.VPC != nil { - body["vpc"] = createEndpointGatewayOptions.VPC - } - if createEndpointGatewayOptions.AllowDnsResolutionBinding != nil { - body["allow_dns_resolution_binding"] = createEndpointGatewayOptions.AllowDnsResolutionBinding + if createLoadBalancerListenerPolicyOptions.Action != nil { + body["action"] = createLoadBalancerListenerPolicyOptions.Action } - if createEndpointGatewayOptions.Ips != nil { - body["ips"] = createEndpointGatewayOptions.Ips + if createLoadBalancerListenerPolicyOptions.Priority != nil { + body["priority"] = createLoadBalancerListenerPolicyOptions.Priority } - if createEndpointGatewayOptions.Name != nil { - body["name"] = createEndpointGatewayOptions.Name + if createLoadBalancerListenerPolicyOptions.Name != nil { + body["name"] = createLoadBalancerListenerPolicyOptions.Name } - if createEndpointGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createEndpointGatewayOptions.ResourceGroup + if createLoadBalancerListenerPolicyOptions.Rules != nil { + body["rules"] = createLoadBalancerListenerPolicyOptions.Rules } - if createEndpointGatewayOptions.SecurityGroups != nil { - body["security_groups"] = createEndpointGatewayOptions.SecurityGroups + if createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -29160,12 +29711,12 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_endpoint_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_load_balancer_listener_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29176,61 +29727,53 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn return } -// ListEndpointGatewayIps : List reserved IPs bound to an endpoint gateway -// This request lists reserved IPs bound to an endpoint gateway. -func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) +// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy +// Deletes a policy of the load balancer listener. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter -func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") +// DeleteLoadBalancerListenerPolicyWithContext is an alternate form of the DeleteLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, + "id": *deleteLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listEndpointGatewayIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) - } - if listEndpointGatewayIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) - } - if listEndpointGatewayIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -29238,69 +29781,61 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "list_endpoint_gateway_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer_listener_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway -// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has -// `auto_delete` set to `true`, the reserved IP will be deleted. -func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy +// Retrieve a single policy specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") +// GetLoadBalancerListenerPolicyWithContext is an alternate form of the GetLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, - "id": *removeEndpointGatewayIPOptions.ID, + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -29311,64 +29846,82 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "remove_endpoint_gateway_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_load_balancer_listener_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway -// This request retrieves the specified reserved IP address if it is bound to the endpoint gateway specified in the URL. -func (vpc *VpcV1) GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) +// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy +// This request updates a load balancer listener policy with the information in a provided policy patch. The policy +// patch object is structured in the same way as a retrieved policy and contains only the information to be updated. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetEndpointGatewayIPWithContext is an alternate form of the GetEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions cannot be nil") +// UpdateLoadBalancerListenerPolicyWithContext is an alternate form of the UpdateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Context, updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, - "id": *getEndpointGatewayIPOptions.ID, + "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -29378,12 +29931,12 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_endpoint_gateway_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_load_balancer_listener_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29394,49 +29947,47 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi return } -// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway -// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: -// -// - must currently be unbound, or not required by its target -// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. -func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +// ListLoadBalancerListenerPolicyRules : List rules of a load balancer listener policy +// This request lists rules of a load balancer listener policy. +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") +// ListLoadBalancerListenerPolicyRulesWithContext is an alternate form of the ListLoadBalancerListenerPolicyRules method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Context, listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, - "id": *addEndpointGatewayIPOptions.ID, + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29454,12 +30005,12 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_endpoint_gateway_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_load_balancer_listener_policy_rules", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29470,48 +30021,142 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi return } -// DeleteEndpointGateway : Delete an endpoint gateway -// This request deletes an endpoint gateway. This operation cannot be reversed. -// -// Reserved IPs that were bound to the endpoint gateway will be released if their -// `auto_delete` property is set to true. -func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy +// Creates a new rule for the load balancer listener policy. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") +// CreateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the CreateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteEndpointGatewayOptions.ID, + "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { + body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition + } + if createLoadBalancerListenerPolicyRuleOptions.Type != nil { + body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type + } + if createLoadBalancerListenerPolicyRuleOptions.Value != nil { + body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value + } + if createLoadBalancerListenerPolicyRuleOptions.Field != nil { + body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "create_load_balancer_listener_policy_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule +// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteLoadBalancerListenerPolicyRuleWithContext is an alternate form of the DeleteLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29527,7 +30172,7 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_endpoint_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer_listener_policy_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -29535,45 +30180,48 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn return } -// GetEndpointGateway : Retrieve an endpoint gateway -// This request retrieves a single endpoint gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule +// Retrieves a single rule specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") +// GetLoadBalancerListenerPolicyRuleWithContext is an alternate form of the GetLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getEndpointGatewayOptions.ID, + "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *getLoadBalancerListenerPolicyRuleOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getEndpointGatewayOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29591,12 +30239,12 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_endpoint_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_load_balancer_listener_policy_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29607,45 +30255,48 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint return } -// UpdateEndpointGateway : Update an endpoint gateway -// This request updates an endpoint gateway's name. -func (vpc *VpcV1) UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) +// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule +// Updates a rule of the load balancer listener policy. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateEndpointGatewayWithContext is an alternate form of the UpdateEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateEndpointGatewayOptions, "updateEndpointGatewayOptions cannot be nil") +// UpdateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the UpdateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateEndpointGatewayOptions.ID, + "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29655,7 +30306,7 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -29670,12 +30321,12 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_endpoint_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_load_balancer_listener_policy_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29686,39 +30337,45 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn return } -// ListFlowLogCollectors : List flow log collectors -// This request lists flow log collectors in the region. A [flow log -// collector](https://cloud.ibm.com/docs/vpc?topic=vpc-flow-logs) summarizes data sent over the instance network -// interfaces and instance network attachments contained within its target. The collected flow logs are written to a -// cloud object storage bucket, where they can be [viewed](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze). -func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +// ListLoadBalancerPools : List pools of a load balancer +// This request lists pools of a load balancer. +func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter -func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") +// ListLoadBalancerPoolsWithContext is an alternate form of the ListLoadBalancerPools method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29726,33 +30383,6 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listFlowLogCollectorsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) - } - if listFlowLogCollectorsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) - } - if listFlowLogCollectorsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) - } - if listFlowLogCollectorsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) - } - if listFlowLogCollectorsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) - } - if listFlowLogCollectorsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) - } - if listFlowLogCollectorsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) - } - if listFlowLogCollectorsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) - } - if listFlowLogCollectorsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) - } request, err := builder.Build() if err != nil { @@ -29763,12 +30393,12 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_flow_log_collectors", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_load_balancer_pools", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29779,43 +30409,45 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow return } -// CreateFlowLogCollector : Create a flow log collector -// This request creates and starts a new flow log collector from a flow log collector prototype object. The prototype -// object is structured in the same way as a retrieved flow log collector, and contains the information necessary to -// create and start the new flow log collector. -func (vpc *VpcV1) CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +// CreateLoadBalancerPool : Create a load balancer pool +// This request creates a new pool from a pool prototype object. +func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateFlowLogCollectorWithContext is an alternate form of the CreateFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createFlowLogCollectorOptions, "createFlowLogCollectorOptions cannot be nil") +// CreateLoadBalancerPoolWithContext is an alternate form of the CreateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29826,20 +30458,26 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createFlowLogCollectorOptions.StorageBucket != nil { - body["storage_bucket"] = createFlowLogCollectorOptions.StorageBucket + if createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm } - if createFlowLogCollectorOptions.Target != nil { - body["target"] = createFlowLogCollectorOptions.Target + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor } - if createFlowLogCollectorOptions.Active != nil { - body["active"] = createFlowLogCollectorOptions.Active + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol } - if createFlowLogCollectorOptions.Name != nil { - body["name"] = createFlowLogCollectorOptions.Name + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members } - if createFlowLogCollectorOptions.ResourceGroup != nil { - body["resource_group"] = createFlowLogCollectorOptions.ResourceGroup + if createLoadBalancerPoolOptions.Name != nil { + body["name"] = createLoadBalancerPoolOptions.Name + } + if createLoadBalancerPoolOptions.ProxyProtocol != nil { + body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol + } + if createLoadBalancerPoolOptions.SessionPersistence != nil { + body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -29856,12 +30494,12 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_flow_log_collector", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_load_balancer_pool", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29872,47 +30510,47 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF return } -// DeleteFlowLogCollector : Delete a flow log collector -// This request stops and deletes a flow log collector. This operation cannot be reversed. -// -// Collected flow logs remain available within the flow log collector's Cloud Object Storage bucket. -func (vpc *VpcV1) DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) +// DeleteLoadBalancerPool : Delete a load balancer pool +// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the +// default pool for any listener in the load balancer. +func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteFlowLogCollectorWithContext is an alternate form of the DeleteFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions cannot be nil") +// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteFlowLogCollectorOptions.ID, + "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, + "id": *deleteLoadBalancerPoolOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29928,7 +30566,7 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_flow_log_collector", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer_pool", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -29936,45 +30574,46 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF return } -// GetFlowLogCollector : Retrieve a flow log collector -// This request retrieves a single flow log collector specified by the identifier in the URL. -func (vpc *VpcV1) GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) +// GetLoadBalancerPool : Retrieve a load balancer pool +// This request retrieves a single pool specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetFlowLogCollectorWithContext is an alternate form of the GetFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getFlowLogCollectorOptions, "getFlowLogCollectorOptions cannot be nil") +// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getFlowLogCollectorOptions.ID, + "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, + "id": *getLoadBalancerPoolOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29992,12 +30631,12 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_flow_log_collector", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_load_balancer_pool", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30008,47 +30647,46 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog return } -// UpdateFlowLogCollector : Update a flow log collector -// This request updates a flow log collector with the information in a provided flow log collector patch. The flow log -// collector patch object is structured in the same way as a retrieved flow log collector and contains only the -// information to be updated. -func (vpc *VpcV1) UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) +// UpdateLoadBalancerPool : Update a load balancer pool +// This request updates a load balancer pool from a pool patch. +func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateFlowLogCollectorWithContext is an alternate form of the UpdateFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions cannot be nil") +// UpdateLoadBalancerPoolWithContext is an alternate form of the UpdateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateFlowLogCollectorOptions.ID, + "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, + "id": *updateLoadBalancerPoolOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30058,7 +30696,7 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -30073,12 +30711,12 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_flow_log_collector", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_load_balancer_pool", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30089,43 +30727,46 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF return } -// ListPrivatePathServiceGateways : List private path service gateways -// This request lists private path service gateways in the region. Private path service gateways allow -// [service -// providers](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components) -// to make their services available using -// [private path -// connectivity](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components). -// Private path service gateways are used to facilitate and manage the private path connectivity between private path -// network load balancers and their associated endpoint gateways. -func (vpc *VpcV1) ListPrivatePathServiceGateways(listPrivatePathServiceGatewaysOptions *ListPrivatePathServiceGatewaysOptions) (result *PrivatePathServiceGatewayCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListPrivatePathServiceGatewaysWithContext(context.Background(), listPrivatePathServiceGatewaysOptions) +// ListLoadBalancerPoolMembers : List members of a load balancer pool +// This request lists members of a load balancer pool. +func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPrivatePathServiceGatewaysWithContext is an alternate form of the ListPrivatePathServiceGateways method which supports a Context parameter -func (vpc *VpcV1) ListPrivatePathServiceGatewaysWithContext(ctx context.Context, listPrivatePathServiceGatewaysOptions *ListPrivatePathServiceGatewaysOptions) (result *PrivatePathServiceGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPrivatePathServiceGatewaysOptions, "listPrivatePathServiceGatewaysOptions") +// ListLoadBalancerPoolMembersWithContext is an alternate form of the ListLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPrivatePathServiceGatewaysOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30133,15 +30774,6 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewaysWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listPrivatePathServiceGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.Start)) - } - if listPrivatePathServiceGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.Limit)) - } - if listPrivatePathServiceGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.ResourceGroupID)) - } request, err := builder.Build() if err != nil { @@ -30152,12 +30784,12 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewaysWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_private_path_service_gateways", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_load_balancer_pool_members", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30168,43 +30800,46 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewaysWithContext(ctx context.Context, return } -// CreatePrivatePathServiceGateway : Create a private path service gateway -// This request creates a private path service gateway from a private path service gateway prototype object. The -// prototype object is structured in the same way as a retrieved private path service gateway, and contains the -// information necessary to create the new private path service gateway. -func (vpc *VpcV1) CreatePrivatePathServiceGateway(createPrivatePathServiceGatewayOptions *CreatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreatePrivatePathServiceGatewayWithContext(context.Background(), createPrivatePathServiceGatewayOptions) +// CreateLoadBalancerPoolMember : Create a member in a load balancer pool +// This request creates a new member and adds the member to the pool. +func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreatePrivatePathServiceGatewayWithContext is an alternate form of the CreatePrivatePathServiceGateway method which supports a Context parameter -func (vpc *VpcV1) CreatePrivatePathServiceGatewayWithContext(ctx context.Context, createPrivatePathServiceGatewayOptions *CreatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPrivatePathServiceGatewayOptions, "createPrivatePathServiceGatewayOptions cannot be nil") +// CreateLoadBalancerPoolMemberWithContext is an alternate form of the CreateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createPrivatePathServiceGatewayOptions, "createPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createPrivatePathServiceGatewayOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30215,23 +30850,99 @@ func (vpc *VpcV1) CreatePrivatePathServiceGatewayWithContext(ctx context.Context builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createPrivatePathServiceGatewayOptions.LoadBalancer != nil { - body["load_balancer"] = createPrivatePathServiceGatewayOptions.LoadBalancer + if createLoadBalancerPoolMemberOptions.Port != nil { + body["port"] = createLoadBalancerPoolMemberOptions.Port } - if createPrivatePathServiceGatewayOptions.ServiceEndpoints != nil { - body["service_endpoints"] = createPrivatePathServiceGatewayOptions.ServiceEndpoints + if createLoadBalancerPoolMemberOptions.Target != nil { + body["target"] = createLoadBalancerPoolMemberOptions.Target } - if createPrivatePathServiceGatewayOptions.DefaultAccessPolicy != nil { - body["default_access_policy"] = createPrivatePathServiceGatewayOptions.DefaultAccessPolicy + if createLoadBalancerPoolMemberOptions.Weight != nil { + body["weight"] = createLoadBalancerPoolMemberOptions.Weight } - if createPrivatePathServiceGatewayOptions.Name != nil { - body["name"] = createPrivatePathServiceGatewayOptions.Name + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } - if createPrivatePathServiceGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createPrivatePathServiceGatewayOptions.ResourceGroup + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if createPrivatePathServiceGatewayOptions.ZonalAffinity != nil { - body["zonal_affinity"] = createPrivatePathServiceGatewayOptions.ZonalAffinity + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "create_load_balancer_pool_member", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members +// This request replaces the existing members of the load balancer pool with new members created from the collection of +// member prototype objects. +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ReplaceLoadBalancerPoolMembersWithContext is an alternate form of the ReplaceLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + body := make(map[string]interface{}) + if replaceLoadBalancerPoolMembersOptions.Members != nil { + body["members"] = replaceLoadBalancerPoolMembersOptions.Members } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -30248,12 +30959,12 @@ func (vpc *VpcV1) CreatePrivatePathServiceGatewayWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_load_balancer_pool_members", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30264,46 +30975,47 @@ func (vpc *VpcV1) CreatePrivatePathServiceGatewayWithContext(ctx context.Context return } -// DeletePrivatePathServiceGateway : Delete a private path service gateway -// This request deletes a private path service gateway. For this request to succeed, the value of -// `endpoint_gateway_count` must be `0`. This operation cannot be reversed. -func (vpc *VpcV1) DeletePrivatePathServiceGateway(deletePrivatePathServiceGatewayOptions *DeletePrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeletePrivatePathServiceGatewayWithContext(context.Background(), deletePrivatePathServiceGatewayOptions) +// DeleteLoadBalancerPoolMember : Delete a load balancer pool member +// This request deletes a member from the pool. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeletePrivatePathServiceGatewayWithContext is an alternate form of the DeletePrivatePathServiceGateway method which supports a Context parameter -func (vpc *VpcV1) DeletePrivatePathServiceGatewayWithContext(ctx context.Context, deletePrivatePathServiceGatewayOptions *DeletePrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePrivatePathServiceGatewayOptions, "deletePrivatePathServiceGatewayOptions cannot be nil") +// DeleteLoadBalancerPoolMemberWithContext is an alternate form of the DeleteLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deletePrivatePathServiceGatewayOptions, "deletePrivatePathServiceGatewayOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deletePrivatePathServiceGatewayOptions.ID, + "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, + "id": *deleteLoadBalancerPoolMemberOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deletePrivatePathServiceGatewayOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30319,7 +31031,7 @@ func (vpc *VpcV1) DeletePrivatePathServiceGatewayWithContext(ctx context.Context response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer_pool_member", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -30327,45 +31039,47 @@ func (vpc *VpcV1) DeletePrivatePathServiceGatewayWithContext(ctx context.Context return } -// GetPrivatePathServiceGateway : Retrieve a private path service gateway -// This request retrieves the private path service gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetPrivatePathServiceGateway(getPrivatePathServiceGatewayOptions *GetPrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetPrivatePathServiceGatewayWithContext(context.Background(), getPrivatePathServiceGatewayOptions) +// GetLoadBalancerPoolMember : Retrieve a load balancer pool member +// This request retrieves a single member specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetPrivatePathServiceGatewayWithContext is an alternate form of the GetPrivatePathServiceGateway method which supports a Context parameter -func (vpc *VpcV1) GetPrivatePathServiceGatewayWithContext(ctx context.Context, getPrivatePathServiceGatewayOptions *GetPrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPrivatePathServiceGatewayOptions, "getPrivatePathServiceGatewayOptions cannot be nil") +// GetLoadBalancerPoolMemberWithContext is an alternate form of the GetLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPrivatePathServiceGatewayOptions, "getPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getPrivatePathServiceGatewayOptions.ID, + "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, + "id": *getLoadBalancerPoolMemberOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPrivatePathServiceGatewayOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30383,12 +31097,12 @@ func (vpc *VpcV1) GetPrivatePathServiceGatewayWithContext(ctx context.Context, g var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_load_balancer_pool_member", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30399,47 +31113,47 @@ func (vpc *VpcV1) GetPrivatePathServiceGatewayWithContext(ctx context.Context, g return } -// UpdatePrivatePathServiceGateway : Update a private path service gateway -// This request updates a private path service gateway with the information provided in a private path service gateway -// patch object. The private path service gateway patch object is structured in the same way as a retrieved private path -// service gateway and contains only the information to be updated. -func (vpc *VpcV1) UpdatePrivatePathServiceGateway(updatePrivatePathServiceGatewayOptions *UpdatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdatePrivatePathServiceGatewayWithContext(context.Background(), updatePrivatePathServiceGatewayOptions) +// UpdateLoadBalancerPoolMember : Update a load balancer pool member +// This request updates an existing member from a member patch. +func (vpc *VpcV1) UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdatePrivatePathServiceGatewayWithContext is an alternate form of the UpdatePrivatePathServiceGateway method which supports a Context parameter -func (vpc *VpcV1) UpdatePrivatePathServiceGatewayWithContext(ctx context.Context, updatePrivatePathServiceGatewayOptions *UpdatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePrivatePathServiceGatewayOptions, "updatePrivatePathServiceGatewayOptions cannot be nil") +// UpdateLoadBalancerPoolMemberWithContext is an alternate form of the UpdateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updatePrivatePathServiceGatewayOptions, "updatePrivatePathServiceGatewayOptions") + err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updatePrivatePathServiceGatewayOptions.ID, + "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, + "id": *updateLoadBalancerPoolMemberOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updatePrivatePathServiceGatewayOptions.Headers { + for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30449,7 +31163,7 @@ func (vpc *VpcV1) UpdatePrivatePathServiceGatewayWithContext(ctx context.Context builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updatePrivatePathServiceGatewayOptions.PrivatePathServiceGatewayPatch) + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -30464,12 +31178,12 @@ func (vpc *VpcV1) UpdatePrivatePathServiceGatewayWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_load_balancer_pool_member", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30480,50 +31194,37 @@ func (vpc *VpcV1) UpdatePrivatePathServiceGatewayWithContext(ctx context.Context return } -// ListPrivatePathServiceGatewayAccountPolicies : List account policies for a private path service gateway -// This request lists account policies for a private path service gateway. Each policy defines how requests to use the -// private path service gateway from that account will be handled. -// -// The account policies will be sorted by their `created_at` property values, with newest account policies first. -// Account policies with identical `created_at` property values will in turn be sorted by ascending `id` property -// values. -func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPolicies(listPrivatePathServiceGatewayAccountPoliciesOptions *ListPrivatePathServiceGatewayAccountPoliciesOptions) (result *PrivatePathServiceGatewayAccountPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListPrivatePathServiceGatewayAccountPoliciesWithContext(context.Background(), listPrivatePathServiceGatewayAccountPoliciesOptions) +// ListEndpointGateways : List endpoint gateways +// This request lists endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to a +// target outside the VPC. +func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPrivatePathServiceGatewayAccountPoliciesWithContext is an alternate form of the ListPrivatePathServiceGatewayAccountPolicies method which supports a Context parameter -func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPoliciesWithContext(ctx context.Context, listPrivatePathServiceGatewayAccountPoliciesOptions *ListPrivatePathServiceGatewayAccountPoliciesOptions) (result *PrivatePathServiceGatewayAccountPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listPrivatePathServiceGatewayAccountPoliciesOptions, "listPrivatePathServiceGatewayAccountPoliciesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listPrivatePathServiceGatewayAccountPoliciesOptions, "listPrivatePathServiceGatewayAccountPoliciesOptions") +// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *listPrivatePathServiceGatewayAccountPoliciesOptions.PrivatePathServiceGatewayID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPrivatePathServiceGatewayAccountPoliciesOptions.Headers { + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayAccountPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30531,14 +31232,32 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPoliciesWithContext(ctx co builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listPrivatePathServiceGatewayAccountPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.Start)) + if listEndpointGatewaysOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) } - if listPrivatePathServiceGatewayAccountPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.Limit)) + if listEndpointGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) } - if listPrivatePathServiceGatewayAccountPoliciesOptions.AccountID != nil { - builder.AddQuery("account.id", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.AccountID)) + if listEndpointGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) + } + if listEndpointGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) + } + if listEndpointGatewaysOptions.LifecycleState != nil { + builder.AddQuery("lifecycle_state", strings.Join(listEndpointGatewaysOptions.LifecycleState, ",")) + } + if listEndpointGatewaysOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listEndpointGatewaysOptions.VPCID)) + } + if listEndpointGatewaysOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listEndpointGatewaysOptions.VPCCRN)) + } + if listEndpointGatewaysOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listEndpointGatewaysOptions.VPCName)) + } + if listEndpointGatewaysOptions.AllowDnsResolutionBinding != nil { + builder.AddQuery("allow_dns_resolution_binding", fmt.Sprint(*listEndpointGatewaysOptions.AllowDnsResolutionBinding)) } request, err := builder.Build() @@ -30550,12 +31269,12 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPoliciesWithContext(ctx co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_private_path_service_gateway_account_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_endpoint_gateways", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30566,46 +31285,42 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPoliciesWithContext(ctx co return } -// CreatePrivatePathServiceGatewayAccountPolicy : Create an account policy for a private path service gateway -// This request creates an account policy from an account policy prototype object. The prototype object is structured in -// the same way as a retrieved account policy, and contains the information necessary to create the new account policy. -func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicy(createPrivatePathServiceGatewayAccountPolicyOptions *CreatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreatePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), createPrivatePathServiceGatewayAccountPolicyOptions) +// CreateEndpointGateway : Create an endpoint gateway +// This request creates a new endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target +// outside the VPC. +func (vpc *VpcV1) CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreatePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the CreatePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter -func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, createPrivatePathServiceGatewayAccountPolicyOptions *CreatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPrivatePathServiceGatewayAccountPolicyOptions, "createPrivatePathServiceGatewayAccountPolicyOptions cannot be nil") +// CreateEndpointGatewayWithContext is an alternate form of the CreateEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createEndpointGatewayOptions, "createEndpointGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createPrivatePathServiceGatewayAccountPolicyOptions, "createPrivatePathServiceGatewayAccountPolicyOptions") + err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *createPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createPrivatePathServiceGatewayAccountPolicyOptions.Headers { + for headerName, headerValue := range createEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGatewayAccountPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30616,11 +31331,26 @@ func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicyWithContext(ctx co builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createPrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy != nil { - body["access_policy"] = createPrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy + if createEndpointGatewayOptions.Target != nil { + body["target"] = createEndpointGatewayOptions.Target } - if createPrivatePathServiceGatewayAccountPolicyOptions.Account != nil { - body["account"] = createPrivatePathServiceGatewayAccountPolicyOptions.Account + if createEndpointGatewayOptions.VPC != nil { + body["vpc"] = createEndpointGatewayOptions.VPC + } + if createEndpointGatewayOptions.AllowDnsResolutionBinding != nil { + body["allow_dns_resolution_binding"] = createEndpointGatewayOptions.AllowDnsResolutionBinding + } + if createEndpointGatewayOptions.Ips != nil { + body["ips"] = createEndpointGatewayOptions.Ips + } + if createEndpointGatewayOptions.Name != nil { + body["name"] = createEndpointGatewayOptions.Name + } + if createEndpointGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createEndpointGatewayOptions.ResourceGroup + } + if createEndpointGatewayOptions.SecurityGroups != nil { + body["security_groups"] = createEndpointGatewayOptions.SecurityGroups } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -30637,12 +31367,12 @@ func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicyWithContext(ctx co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_private_path_service_gateway_account_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_endpoint_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30653,53 +31383,61 @@ func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicyWithContext(ctx co return } -// DeletePrivatePathServiceGatewayAccountPolicy : Delete an account policy for a private path service gateway -// This request deletes an account policy. This operation cannot be reversed and it does not affect the `status` of any -// existing endpoint gateway bindings. -func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicy(deletePrivatePathServiceGatewayAccountPolicyOptions *DeletePrivatePathServiceGatewayAccountPolicyOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeletePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), deletePrivatePathServiceGatewayAccountPolicyOptions) +// ListEndpointGatewayIps : List reserved IPs bound to an endpoint gateway +// This request lists reserved IPs bound to an endpoint gateway. +func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeletePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the DeletePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter -func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, deletePrivatePathServiceGatewayAccountPolicyOptions *DeletePrivatePathServiceGatewayAccountPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions cannot be nil") +// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions") + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *deletePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, - "id": *deletePrivatePathServiceGatewayAccountPolicyOptions.ID, + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deletePrivatePathServiceGatewayAccountPolicyOptions.Headers { + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGatewayAccountPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listEndpointGatewayIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) + } + if listEndpointGatewayIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) + } + if listEndpointGatewayIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -30707,60 +31445,69 @@ func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicyWithContext(ctx co return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_private_path_service_gateway_account_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_endpoint_gateway_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetPrivatePathServiceGatewayAccountPolicy : Retrieve an account policy for a private path service gateway -// This request retrieves a single account policy specified by the identifier in the URL. -func (vpc *VpcV1) GetPrivatePathServiceGatewayAccountPolicy(getPrivatePathServiceGatewayAccountPolicyOptions *GetPrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetPrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), getPrivatePathServiceGatewayAccountPolicyOptions) +// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway +// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetPrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the GetPrivatePathServiceGatewayAccountPolicy method which supports a Context parameter -func (vpc *VpcV1) GetPrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, getPrivatePathServiceGatewayAccountPolicyOptions *GetPrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions cannot be nil") +// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions") + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *getPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, - "id": *getPrivatePathServiceGatewayAccountPolicyOptions.ID, + "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, + "id": *removeEndpointGatewayIPOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPrivatePathServiceGatewayAccountPolicyOptions.Headers { + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayAccountPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -30771,82 +31518,64 @@ func (vpc *VpcV1) GetPrivatePathServiceGatewayAccountPolicyWithContext(ctx conte return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_private_path_service_gateway_account_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_endpoint_gateway_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdatePrivatePathServiceGatewayAccountPolicy : Update an account policy for a private path service gateway -// This request updates an account policy with the information in a provided account policy patch. The account policy -// patch object is structured in the same way as a retrieved account policy and contains only the information to be -// updated. -func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicy(updatePrivatePathServiceGatewayAccountPolicyOptions *UpdatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdatePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), updatePrivatePathServiceGatewayAccountPolicyOptions) +// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway +// This request retrieves the specified reserved IP address if it is bound to the endpoint gateway specified in the URL. +func (vpc *VpcV1) GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdatePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the UpdatePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, updatePrivatePathServiceGatewayAccountPolicyOptions *UpdatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions cannot be nil") +// GetEndpointGatewayIPWithContext is an alternate form of the GetEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions") + err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *updatePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, - "id": *updatePrivatePathServiceGatewayAccountPolicyOptions.ID, + "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, + "id": *getEndpointGatewayIPOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updatePrivatePathServiceGatewayAccountPolicyOptions.Headers { + for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGatewayAccountPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updatePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayAccountPolicyPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -30856,12 +31585,12 @@ func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicyWithContext(ctx co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_private_path_service_gateway_account_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_endpoint_gateway_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30872,52 +31601,49 @@ func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicyWithContext(ctx co return } -// ListPrivatePathServiceGatewayEndpointGatewayBindings : List endpoint gateway bindings for a private path service gateway -// This request lists endpoint gateway bindings for a private path service gateway. Each endpoint gateway binding is -// implicitly created when an endpoint gateway is created targeting the private path service gateway. The associated -// account policy is applied to all new endpoint gateway bindings. If an associated account policy doesn't exist, the -// private path service gateway's `default_access_policy` is used. +// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway +// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: // -// The endpoint gateway bindings will be sorted by their `created_at` property values, with newest endpoint gateway -// bindings first. Endpoint gateway bindings with identical -// `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindings(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) (result *PrivatePathServiceGatewayEndpointGatewayBindingCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(context.Background(), listPrivatePathServiceGatewayEndpointGatewayBindingsOptions) +// - must currently be unbound, or not required by its target +// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. +func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext is an alternate form of the ListPrivatePathServiceGatewayEndpointGatewayBindings method which supports a Context parameter -func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(ctx context.Context, listPrivatePathServiceGatewayEndpointGatewayBindingsOptions *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) (result *PrivatePathServiceGatewayEndpointGatewayBindingCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions, "listPrivatePathServiceGatewayEndpointGatewayBindingsOptions cannot be nil") +// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions, "listPrivatePathServiceGatewayEndpointGatewayBindingsOptions") + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.PrivatePathServiceGatewayID, + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Headers { + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayEndpointGatewayBindings") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -30925,18 +31651,6 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContex builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Start)) - } - if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Limit)) - } - if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status)) - } - if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.AccountID != nil { - builder.AddQuery("account.id", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.AccountID)) - } request, err := builder.Build() if err != nil { @@ -30947,12 +31661,12 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_private_path_service_gateway_endpoint_gateway_bindings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_endpoint_gateway_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30963,46 +31677,110 @@ func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContex return } -// GetPrivatePathServiceGatewayEndpointGatewayBinding : Retrieve an endpoint gateway binding for a private path service gateway -// This request retrieves a single endpoint gateway binding specified by the identifier in the URL. -func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBinding(getPrivatePathServiceGatewayEndpointGatewayBindingOptions *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) (result *PrivatePathServiceGatewayEndpointGatewayBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), getPrivatePathServiceGatewayEndpointGatewayBindingOptions) - err = core.RepurposeSDKProblem(err, "") +// DeleteEndpointGateway : Delete an endpoint gateway +// This request deletes an endpoint gateway. This operation cannot be reversed. +// +// Reserved IPs that were bound to the endpoint gateway will be released if their +// `auto_delete` property is set to true. +func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) + err = core.RepurposeSDKProblem(err, "") return } -// GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the GetPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter -func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, getPrivatePathServiceGatewayEndpointGatewayBindingOptions *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) (result *PrivatePathServiceGatewayEndpointGatewayBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPrivatePathServiceGatewayEndpointGatewayBindingOptions, "getPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil") +// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPrivatePathServiceGatewayEndpointGatewayBindingOptions, "getPrivatePathServiceGatewayEndpointGatewayBindingOptions") + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *getPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, - "id": *getPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID, + "id": *deleteEndpointGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_endpoint_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetEndpointGateway : Retrieve an endpoint gateway +// This request retrieves a single endpoint gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *getEndpointGatewayOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + for headerName, headerValue := range getEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayEndpointGatewayBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -31020,12 +31798,12 @@ func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext( var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_endpoint_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -31036,60 +31814,55 @@ func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext( return } -// DenyPrivatePathServiceGatewayEndpointGatewayBinding : Deny an endpoint gateway binding for a private path service gateway -// This request denies a `pending` endpoint gateway request, and optionally sets the policy to deny future requests from -// the same account. -func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBinding(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), denyPrivatePathServiceGatewayEndpointGatewayBindingOptions) +// UpdateEndpointGateway : Update an endpoint gateway +// This request updates an endpoint gateway's name. +func (vpc *VpcV1) UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the DenyPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter -func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, denyPrivatePathServiceGatewayEndpointGatewayBindingOptions *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil") +// UpdateEndpointGatewayWithContext is an alternate form of the UpdateEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateEndpointGatewayOptions, "updateEndpointGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions") + err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, - "id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID, + "id": *updateEndpointGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/deny`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + for headerName, headerValue := range updateEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DenyPrivatePathServiceGatewayEndpointGatewayBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy != nil { - body["set_account_policy"] = denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -31101,68 +31874,179 @@ func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "deny_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_endpoint_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// PermitPrivatePathServiceGatewayEndpointGatewayBinding : Permit an endpoint gateway binding for a private path service gateway -// This request permits a `pending` endpoint gateway request, and optionally sets the policy to permit future requests -// from the same account. -func (vpc *VpcV1) PermitPrivatePathServiceGatewayEndpointGatewayBinding(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), permitPrivatePathServiceGatewayEndpointGatewayBindingOptions) +// ListFlowLogCollectors : List flow log collectors +// This request lists flow log collectors in the region. A [flow log +// collector](https://cloud.ibm.com/docs/vpc?topic=vpc-flow-logs) summarizes data sent over the instance network +// interfaces and instance network attachments contained within its target. The collected flow logs are written to a +// cloud object storage bucket, where they can be [viewed](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze). +func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) err = core.RepurposeSDKProblem(err, "") return } -// PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the PermitPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter -func (vpc *VpcV1) PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, permitPrivatePathServiceGatewayEndpointGatewayBindingOptions *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions, "permitPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil") +// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter +func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - err = core.ValidateStruct(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions, "permitPrivatePathServiceGatewayEndpointGatewayBindingOptions") + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, - "id": *permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID, + for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listFlowLogCollectorsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) + } + if listFlowLogCollectorsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) + } + if listFlowLogCollectorsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) + } + if listFlowLogCollectorsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) + } + if listFlowLogCollectorsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) + } + if listFlowLogCollectorsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) + } + if listFlowLogCollectorsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) + } + if listFlowLogCollectorsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) + } + if listFlowLogCollectorsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_flow_log_collectors", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// CreateFlowLogCollector : Create a flow log collector +// This request creates and starts a new flow log collector from a flow log collector prototype object. The prototype +// object is structured in the same way as a retrieved flow log collector, and contains the information necessary to +// create and start the new flow log collector. +func (vpc *VpcV1) CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateFlowLogCollectorWithContext is an alternate form of the CreateFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createFlowLogCollectorOptions, "createFlowLogCollectorOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/permit`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + for headerName, headerValue := range createFlowLogCollectorOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PermitPrivatePathServiceGatewayEndpointGatewayBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy != nil { - body["set_account_policy"] = permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy + if createFlowLogCollectorOptions.StorageBucket != nil { + body["storage_bucket"] = createFlowLogCollectorOptions.StorageBucket + } + if createFlowLogCollectorOptions.Target != nil { + body["target"] = createFlowLogCollectorOptions.Target + } + if createFlowLogCollectorOptions.Active != nil { + body["active"] = createFlowLogCollectorOptions.Active + } + if createFlowLogCollectorOptions.Name != nil { + body["name"] = createFlowLogCollectorOptions.Name + } + if createFlowLogCollectorOptions.ResourceGroup != nil { + body["resource_group"] = createFlowLogCollectorOptions.ResourceGroup } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -31176,55 +32060,66 @@ func (vpc *VpcV1) PermitPrivatePathServiceGatewayEndpointGatewayBindingWithConte return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "permit_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_flow_log_collector", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// PublishPrivatePathServiceGateway : Publish a private path service gateway -// This request publishes a private path service gateway, allowing any account to request access to it. -func (vpc *VpcV1) PublishPrivatePathServiceGateway(publishPrivatePathServiceGatewayOptions *PublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.PublishPrivatePathServiceGatewayWithContext(context.Background(), publishPrivatePathServiceGatewayOptions) +// DeleteFlowLogCollector : Delete a flow log collector +// This request stops and deletes a flow log collector. This operation cannot be reversed. +// +// Collected flow logs remain available within the flow log collector's Cloud Object Storage bucket. +func (vpc *VpcV1) DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) err = core.RepurposeSDKProblem(err, "") return } -// PublishPrivatePathServiceGatewayWithContext is an alternate form of the PublishPrivatePathServiceGateway method which supports a Context parameter -func (vpc *VpcV1) PublishPrivatePathServiceGatewayWithContext(ctx context.Context, publishPrivatePathServiceGatewayOptions *PublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions cannot be nil") +// DeleteFlowLogCollectorWithContext is an alternate form of the DeleteFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *publishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + "id": *deleteFlowLogCollectorOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/publish`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range publishPrivatePathServiceGatewayOptions.Headers { + for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PublishPrivatePathServiceGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -31240,7 +32135,7 @@ func (vpc *VpcV1) PublishPrivatePathServiceGatewayWithContext(ctx context.Contex response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "publish_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_flow_log_collector", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -31248,470 +32143,1782 @@ func (vpc *VpcV1) PublishPrivatePathServiceGatewayWithContext(ctx context.Contex return } -// RevokeAccountForPrivatePathServiceGateway : Revoke access to a private path service gateway for an account -// This request revokes a consumer account. This operation cannot be reversed. The `status` of all endpoint gateway -// bindings associated with the specified private path service gateway become `denied`. If the specified account has an -// existing access policy, that policy will be updated to `denied`. Otherwise, a new `deny` access policy will be -// created for the account. -func (vpc *VpcV1) RevokeAccountForPrivatePathServiceGateway(revokeAccountForPrivatePathServiceGatewayOptions *RevokeAccountForPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RevokeAccountForPrivatePathServiceGatewayWithContext(context.Background(), revokeAccountForPrivatePathServiceGatewayOptions) +// GetFlowLogCollector : Retrieve a flow log collector +// This request retrieves a single flow log collector specified by the identifier in the URL. +func (vpc *VpcV1) GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) err = core.RepurposeSDKProblem(err, "") return } -// RevokeAccountForPrivatePathServiceGatewayWithContext is an alternate form of the RevokeAccountForPrivatePathServiceGateway method which supports a Context parameter -func (vpc *VpcV1) RevokeAccountForPrivatePathServiceGatewayWithContext(ctx context.Context, revokeAccountForPrivatePathServiceGatewayOptions *RevokeAccountForPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(revokeAccountForPrivatePathServiceGatewayOptions, "revokeAccountForPrivatePathServiceGatewayOptions cannot be nil") +// GetFlowLogCollectorWithContext is an alternate form of the GetFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getFlowLogCollectorOptions, "getFlowLogCollectorOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(revokeAccountForPrivatePathServiceGatewayOptions, "revokeAccountForPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *revokeAccountForPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + "id": *getFlowLogCollectorOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/revoke_account`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range revokeAccountForPrivatePathServiceGatewayOptions.Headers { + for headerName, headerValue := range getFlowLogCollectorOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RevokeAccountForPrivatePathServiceGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if revokeAccountForPrivatePathServiceGatewayOptions.Account != nil { - body["account"] = revokeAccountForPrivatePathServiceGatewayOptions.Account - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "revoke_account_for_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_flow_log_collector", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UnpublishPrivatePathServiceGateway : Unpublish a private path service gateway -// This request unpublishes a private path service gateway. For this request to succeed, any existing access from other -// accounts must first be revoked. Once unpublished, access will again be restricted to the account that created this -// private path service gateway. -func (vpc *VpcV1) UnpublishPrivatePathServiceGateway(unpublishPrivatePathServiceGatewayOptions *UnpublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.UnpublishPrivatePathServiceGatewayWithContext(context.Background(), unpublishPrivatePathServiceGatewayOptions) +// UpdateFlowLogCollector : Update a flow log collector +// This request updates a flow log collector with the information in a provided flow log collector patch. The flow log +// collector patch object is structured in the same way as a retrieved flow log collector and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) err = core.RepurposeSDKProblem(err, "") return } -// UnpublishPrivatePathServiceGatewayWithContext is an alternate form of the UnpublishPrivatePathServiceGateway method which supports a Context parameter -func (vpc *VpcV1) UnpublishPrivatePathServiceGatewayWithContext(ctx context.Context, unpublishPrivatePathServiceGatewayOptions *UnpublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(unpublishPrivatePathServiceGatewayOptions, "unpublishPrivatePathServiceGatewayOptions cannot be nil") +// UpdateFlowLogCollectorWithContext is an alternate form of the UpdateFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(unpublishPrivatePathServiceGatewayOptions, "unpublishPrivatePathServiceGatewayOptions") + err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "private_path_service_gateway_id": *unpublishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + "id": *updateFlowLogCollectorOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/unpublish`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range unpublishPrivatePathServiceGatewayOptions.Headers { + for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnpublishPrivatePathServiceGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "unpublish_private_path_service_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_flow_log_collector", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -func getServiceComponentInfo() *core.ProblemComponent { - return core.NewProblemComponent(DefaultServiceName, "2024-10-15") -} - -// AccountIdentity : Identifies an account by a unique property. -// Models which "extend" this model: -// - AccountIdentityByID -type AccountIdentity struct { - // The unique identifier for this account. - ID *string `json:"id,omitempty"` -} -func (*AccountIdentity) isaAccountIdentity() bool { - return true +// ListPrivatePathServiceGateways : List private path service gateways +// This request lists private path service gateways in the region. Private path service gateways allow +// [service +// providers](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components) +// to make their services available using +// [private path +// connectivity](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components). +// Private path service gateways are used to facilitate and manage the private path connectivity between private path +// network load balancers and their associated endpoint gateways. +func (vpc *VpcV1) ListPrivatePathServiceGateways(listPrivatePathServiceGatewaysOptions *ListPrivatePathServiceGatewaysOptions) (result *PrivatePathServiceGatewayCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListPrivatePathServiceGatewaysWithContext(context.Background(), listPrivatePathServiceGatewaysOptions) + err = core.RepurposeSDKProblem(err, "") + return } -type AccountIdentityIntf interface { - isaAccountIdentity() bool -} +// ListPrivatePathServiceGatewaysWithContext is an alternate form of the ListPrivatePathServiceGateways method which supports a Context parameter +func (vpc *VpcV1) ListPrivatePathServiceGatewaysWithContext(ctx context.Context, listPrivatePathServiceGatewaysOptions *ListPrivatePathServiceGatewaysOptions) (result *PrivatePathServiceGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPrivatePathServiceGatewaysOptions, "listPrivatePathServiceGatewaysOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } -// UnmarshalAccountIdentity unmarshals an instance of AccountIdentity from the specified map of raw messages. -func UnmarshalAccountIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AccountIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways`, nil) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// AccountReference : AccountReference struct -type AccountReference struct { - // The unique identifier for this account. - ID *string `json:"id" validate:"required"` + for headerName, headerValue := range listPrivatePathServiceGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") -// Constants associated with the AccountReference.ResourceType property. -// The resource type. -const ( - AccountReferenceResourceTypeAccountConst = "account" -) + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listPrivatePathServiceGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.Start)) + } + if listPrivatePathServiceGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.Limit)) + } + if listPrivatePathServiceGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.ResourceGroupID)) + } -// UnmarshalAccountReference unmarshals an instance of AccountReference from the specified map of raw messages. -func UnmarshalAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AccountReference) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "list_private_path_service_gateways", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + return } -// ActivateReservationOptions : The ActivateReservation options. -type ActivateReservationOptions struct { - // The reservation identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string +// CreatePrivatePathServiceGateway : Create a private path service gateway +// This request creates a private path service gateway from a private path service gateway prototype object. The +// prototype object is structured in the same way as a retrieved private path service gateway, and contains the +// information necessary to create the new private path service gateway. +func (vpc *VpcV1) CreatePrivatePathServiceGateway(createPrivatePathServiceGatewayOptions *CreatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreatePrivatePathServiceGatewayWithContext(context.Background(), createPrivatePathServiceGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// NewActivateReservationOptions : Instantiate ActivateReservationOptions -func (*VpcV1) NewActivateReservationOptions(id string) *ActivateReservationOptions { - return &ActivateReservationOptions{ - ID: core.StringPtr(id), +// CreatePrivatePathServiceGatewayWithContext is an alternate form of the CreatePrivatePathServiceGateway method which supports a Context parameter +func (vpc *VpcV1) CreatePrivatePathServiceGatewayWithContext(ctx context.Context, createPrivatePathServiceGatewayOptions *CreatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPrivatePathServiceGatewayOptions, "createPrivatePathServiceGatewayOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createPrivatePathServiceGatewayOptions, "createPrivatePathServiceGatewayOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } -} -// SetID : Allow user to set ID -func (_options *ActivateReservationOptions) SetID(id string) *ActivateReservationOptions { - _options.ID = core.StringPtr(id) - return _options -} + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } -// SetHeaders : Allow user to set Headers -func (options *ActivateReservationOptions) SetHeaders(param map[string]string) *ActivateReservationOptions { - options.Headers = param - return options -} + for headerName, headerValue := range createPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. -type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") - // The bare metal server network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` + body := make(map[string]interface{}) + if createPrivatePathServiceGatewayOptions.LoadBalancer != nil { + body["load_balancer"] = createPrivatePathServiceGatewayOptions.LoadBalancer + } + if createPrivatePathServiceGatewayOptions.ServiceEndpoints != nil { + body["service_endpoints"] = createPrivatePathServiceGatewayOptions.ServiceEndpoints + } + if createPrivatePathServiceGatewayOptions.DefaultAccessPolicy != nil { + body["default_access_policy"] = createPrivatePathServiceGatewayOptions.DefaultAccessPolicy + } + if createPrivatePathServiceGatewayOptions.Name != nil { + body["name"] = createPrivatePathServiceGatewayOptions.Name + } + if createPrivatePathServiceGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createPrivatePathServiceGatewayOptions.ResourceGroup + } + if createPrivatePathServiceGatewayOptions.ZonalAffinity != nil { + body["zonal_affinity"] = createPrivatePathServiceGatewayOptions.ZonalAffinity + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } - // Allows users to set headers on API requests - Headers map[string]string -} + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } -// NewAddBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate AddBareMetalServerNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewAddBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - return &AddBareMetalServerNetworkInterfaceFloatingIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "create_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result } -} -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options + return } -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options +// DeletePrivatePathServiceGateway : Delete a private path service gateway +// This request deletes a private path service gateway. For this request to succeed, the value of +// `endpoint_gateway_count` must be `0`. This operation cannot be reversed. +func (vpc *VpcV1) DeletePrivatePathServiceGateway(deletePrivatePathServiceGatewayOptions *DeletePrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeletePrivatePathServiceGatewayWithContext(context.Background(), deletePrivatePathServiceGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// SetID : Allow user to set ID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} +// DeletePrivatePathServiceGatewayWithContext is an alternate form of the DeletePrivatePathServiceGateway method which supports a Context parameter +func (vpc *VpcV1) DeletePrivatePathServiceGatewayWithContext(ctx context.Context, deletePrivatePathServiceGatewayOptions *DeletePrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePrivatePathServiceGatewayOptions, "deletePrivatePathServiceGatewayOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deletePrivatePathServiceGatewayOptions, "deletePrivatePathServiceGatewayOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } -// SetHeaders : Allow user to set Headers -func (options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} + pathParamsMap := map[string]string{ + "id": *deletePrivatePathServiceGatewayOptions.ID, + } -// AddEndpointGatewayIPOptions : The AddEndpointGatewayIP options. -type AddEndpointGatewayIPOptions struct { - // The endpoint gateway identifier. - EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` + for headerName, headerValue := range deletePrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // Allows users to set headers on API requests - Headers map[string]string -} + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } -// NewAddEndpointGatewayIPOptions : Instantiate AddEndpointGatewayIPOptions -func (*VpcV1) NewAddEndpointGatewayIPOptions(endpointGatewayID string, id string) *AddEndpointGatewayIPOptions { - return &AddEndpointGatewayIPOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - ID: core.StringPtr(id), + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } -} -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *AddEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *AddEndpointGatewayIPOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options -} + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } -// SetID : Allow user to set ID -func (_options *AddEndpointGatewayIPOptions) SetID(id string) *AddEndpointGatewayIPOptions { - _options.ID = core.StringPtr(id) - return _options + return } -// SetHeaders : Allow user to set Headers -func (options *AddEndpointGatewayIPOptions) SetHeaders(param map[string]string) *AddEndpointGatewayIPOptions { - options.Headers = param - return options +// GetPrivatePathServiceGateway : Retrieve a private path service gateway +// This request retrieves the private path service gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetPrivatePathServiceGateway(getPrivatePathServiceGatewayOptions *GetPrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetPrivatePathServiceGatewayWithContext(context.Background(), getPrivatePathServiceGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. -type AddInstanceNetworkInterfaceFloatingIPOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` +// GetPrivatePathServiceGatewayWithContext is an alternate form of the GetPrivatePathServiceGateway method which supports a Context parameter +func (vpc *VpcV1) GetPrivatePathServiceGatewayWithContext(ctx context.Context, getPrivatePathServiceGatewayOptions *GetPrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPrivatePathServiceGatewayOptions, "getPrivatePathServiceGatewayOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getPrivatePathServiceGatewayOptions, "getPrivatePathServiceGatewayOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } - // The instance network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + pathParamsMap := map[string]string{ + "id": *getPrivatePathServiceGatewayOptions.ID, + } - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } - // Allows users to set headers on API requests - Headers map[string]string -} + for headerName, headerValue := range getPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// NewAddInstanceNetworkInterfaceFloatingIPOptions : Instantiate AddInstanceNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewAddInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *AddInstanceNetworkInterfaceFloatingIPOptions { - return &AddInstanceNetworkInterfaceFloatingIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } -} + builder.AddHeader("Accept", "application/json") -// SetInstanceID : Allow user to set InstanceID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } -// SetID : Allow user to set ID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "get_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } -// SetHeaders : Allow user to set Headers -func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddInstanceNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options + return } -// AddNetworkInterfaceFloatingIPOptions : The AddNetworkInterfaceFloatingIP options. -type AddNetworkInterfaceFloatingIPOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` - - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string +// UpdatePrivatePathServiceGateway : Update a private path service gateway +// This request updates a private path service gateway with the information provided in a private path service gateway +// patch object. The private path service gateway patch object is structured in the same way as a retrieved private path +// service gateway and contains only the information to be updated. +func (vpc *VpcV1) UpdatePrivatePathServiceGateway(updatePrivatePathServiceGatewayOptions *UpdatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdatePrivatePathServiceGatewayWithContext(context.Background(), updatePrivatePathServiceGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// NewAddNetworkInterfaceFloatingIPOptions : Instantiate AddNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewAddNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *AddNetworkInterfaceFloatingIPOptions { - return &AddNetworkInterfaceFloatingIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), +// UpdatePrivatePathServiceGatewayWithContext is an alternate form of the UpdatePrivatePathServiceGateway method which supports a Context parameter +func (vpc *VpcV1) UpdatePrivatePathServiceGatewayWithContext(ctx context.Context, updatePrivatePathServiceGatewayOptions *UpdatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePrivatePathServiceGatewayOptions, "updatePrivatePathServiceGatewayOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updatePrivatePathServiceGatewayOptions, "updatePrivatePathServiceGatewayOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } -} -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *AddNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddNetworkInterfaceFloatingIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} + pathParamsMap := map[string]string{ + "id": *updatePrivatePathServiceGatewayOptions.ID, + } -// SetID : Allow user to set ID -func (_options *AddNetworkInterfaceFloatingIPOptions) SetID(id string) *AddNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } -// SetHeaders : Allow user to set Headers -func (options *AddNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} + for headerName, headerValue := range updatePrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// AddVirtualNetworkInterfaceIPOptions : The AddVirtualNetworkInterfaceIP options. -type AddVirtualNetworkInterfaceIPOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - // Allows users to set headers on API requests - Headers map[string]string -} + _, err = builder.SetBodyContentJSON(updatePrivatePathServiceGatewayOptions.PrivatePathServiceGatewayPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } -// NewAddVirtualNetworkInterfaceIPOptions : Instantiate AddVirtualNetworkInterfaceIPOptions -func (*VpcV1) NewAddVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *AddVirtualNetworkInterfaceIPOptions { - return &AddVirtualNetworkInterfaceIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } -} -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *AddVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddVirtualNetworkInterfaceIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "update_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } -// SetID : Allow user to set ID -func (_options *AddVirtualNetworkInterfaceIPOptions) SetID(id string) *AddVirtualNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options + return } -// SetHeaders : Allow user to set Headers -func (options *AddVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *AddVirtualNetworkInterfaceIPOptions { - options.Headers = param - return options +// ListPrivatePathServiceGatewayAccountPolicies : List account policies for a private path service gateway +// This request lists account policies for a private path service gateway. Each policy defines how requests to use the +// private path service gateway from that account will be handled. +// +// The account policies will be sorted by their `created_at` property values, with newest account policies first. +// Account policies with identical `created_at` property values will in turn be sorted by ascending `id` property +// values. +func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPolicies(listPrivatePathServiceGatewayAccountPoliciesOptions *ListPrivatePathServiceGatewayAccountPoliciesOptions) (result *PrivatePathServiceGatewayAccountPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListPrivatePathServiceGatewayAccountPoliciesWithContext(context.Background(), listPrivatePathServiceGatewayAccountPoliciesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// AddVPNGatewayConnectionsLocalCIDROptions : The AddVPNGatewayConnectionsLocalCIDR options. -type AddVPNGatewayConnectionsLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` +// ListPrivatePathServiceGatewayAccountPoliciesWithContext is an alternate form of the ListPrivatePathServiceGatewayAccountPolicies method which supports a Context parameter +func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPoliciesWithContext(ctx context.Context, listPrivatePathServiceGatewayAccountPoliciesOptions *ListPrivatePathServiceGatewayAccountPoliciesOptions) (result *PrivatePathServiceGatewayAccountPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listPrivatePathServiceGatewayAccountPoliciesOptions, "listPrivatePathServiceGatewayAccountPoliciesOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listPrivatePathServiceGatewayAccountPoliciesOptions, "listPrivatePathServiceGatewayAccountPoliciesOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *listPrivatePathServiceGatewayAccountPoliciesOptions.PrivatePathServiceGatewayID, + } - // The IP address range in CIDR block notation. - CIDR *string `json:"cidr" validate:"required,ne="` + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } - // Allows users to set headers on API requests - Headers map[string]string -} + for headerName, headerValue := range listPrivatePathServiceGatewayAccountPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// NewAddVPNGatewayConnectionsLocalCIDROptions : Instantiate AddVPNGatewayConnectionsLocalCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *AddVPNGatewayConnectionsLocalCIDROptions { - return &AddVPNGatewayConnectionsLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDR: core.StringPtr(cidr), + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayAccountPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } -} + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listPrivatePathServiceGatewayAccountPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.Start)) + } + if listPrivatePathServiceGatewayAccountPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.Limit)) + } + if listPrivatePathServiceGatewayAccountPoliciesOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.AccountID)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_private_path_service_gateway_account_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicyCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// CreatePrivatePathServiceGatewayAccountPolicy : Create an account policy for a private path service gateway +// This request creates an account policy from an account policy prototype object. The prototype object is structured in +// the same way as a retrieved account policy, and contains the information necessary to create the new account policy. +func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicy(createPrivatePathServiceGatewayAccountPolicyOptions *CreatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreatePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), createPrivatePathServiceGatewayAccountPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreatePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the CreatePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter +func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, createPrivatePathServiceGatewayAccountPolicyOptions *CreatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPrivatePathServiceGatewayAccountPolicyOptions, "createPrivatePathServiceGatewayAccountPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createPrivatePathServiceGatewayAccountPolicyOptions, "createPrivatePathServiceGatewayAccountPolicyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *createPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createPrivatePathServiceGatewayAccountPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + body := make(map[string]interface{}) + if createPrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy != nil { + body["access_policy"] = createPrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy + } + if createPrivatePathServiceGatewayAccountPolicyOptions.Account != nil { + body["account"] = createPrivatePathServiceGatewayAccountPolicyOptions.Account + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "create_private_path_service_gateway_account_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeletePrivatePathServiceGatewayAccountPolicy : Delete an account policy for a private path service gateway +// This request deletes an account policy. This operation cannot be reversed and it does not affect the `status` of any +// existing endpoint gateway bindings. +func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicy(deletePrivatePathServiceGatewayAccountPolicyOptions *DeletePrivatePathServiceGatewayAccountPolicyOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeletePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), deletePrivatePathServiceGatewayAccountPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeletePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the DeletePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter +func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, deletePrivatePathServiceGatewayAccountPolicyOptions *DeletePrivatePathServiceGatewayAccountPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *deletePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + "id": *deletePrivatePathServiceGatewayAccountPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deletePrivatePathServiceGatewayAccountPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_private_path_service_gateway_account_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetPrivatePathServiceGatewayAccountPolicy : Retrieve an account policy for a private path service gateway +// This request retrieves a single account policy specified by the identifier in the URL. +func (vpc *VpcV1) GetPrivatePathServiceGatewayAccountPolicy(getPrivatePathServiceGatewayAccountPolicyOptions *GetPrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetPrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), getPrivatePathServiceGatewayAccountPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetPrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the GetPrivatePathServiceGatewayAccountPolicy method which supports a Context parameter +func (vpc *VpcV1) GetPrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, getPrivatePathServiceGatewayAccountPolicyOptions *GetPrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *getPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + "id": *getPrivatePathServiceGatewayAccountPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getPrivatePathServiceGatewayAccountPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "get_private_path_service_gateway_account_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// UpdatePrivatePathServiceGatewayAccountPolicy : Update an account policy for a private path service gateway +// This request updates an account policy with the information in a provided account policy patch. The account policy +// patch object is structured in the same way as a retrieved account policy and contains only the information to be +// updated. +func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicy(updatePrivatePathServiceGatewayAccountPolicyOptions *UpdatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdatePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), updatePrivatePathServiceGatewayAccountPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdatePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the UpdatePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, updatePrivatePathServiceGatewayAccountPolicyOptions *UpdatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *updatePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + "id": *updatePrivatePathServiceGatewayAccountPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updatePrivatePathServiceGatewayAccountPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + _, err = builder.SetBodyContentJSON(updatePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayAccountPolicyPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "update_private_path_service_gateway_account_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListPrivatePathServiceGatewayEndpointGatewayBindings : List endpoint gateway bindings for a private path service gateway +// This request lists endpoint gateway bindings for a private path service gateway. Each endpoint gateway binding is +// implicitly created when an endpoint gateway is created targeting the private path service gateway. The associated +// account policy is applied to all new endpoint gateway bindings. If an associated account policy doesn't exist, the +// private path service gateway's `default_access_policy` is used. +// +// The endpoint gateway bindings will be sorted by their `created_at` property values, with newest endpoint gateway +// bindings first. Endpoint gateway bindings with identical +// `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindings(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) (result *PrivatePathServiceGatewayEndpointGatewayBindingCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(context.Background(), listPrivatePathServiceGatewayEndpointGatewayBindingsOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext is an alternate form of the ListPrivatePathServiceGatewayEndpointGatewayBindings method which supports a Context parameter +func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(ctx context.Context, listPrivatePathServiceGatewayEndpointGatewayBindingsOptions *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) (result *PrivatePathServiceGatewayEndpointGatewayBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions, "listPrivatePathServiceGatewayEndpointGatewayBindingsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions, "listPrivatePathServiceGatewayEndpointGatewayBindingsOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.PrivatePathServiceGatewayID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayEndpointGatewayBindings") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Start)) + } + if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Limit)) + } + if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status)) + } + if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.AccountID)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_private_path_service_gateway_endpoint_gateway_bindings", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetPrivatePathServiceGatewayEndpointGatewayBinding : Retrieve an endpoint gateway binding for a private path service gateway +// This request retrieves a single endpoint gateway binding specified by the identifier in the URL. +func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBinding(getPrivatePathServiceGatewayEndpointGatewayBindingOptions *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) (result *PrivatePathServiceGatewayEndpointGatewayBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), getPrivatePathServiceGatewayEndpointGatewayBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the GetPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter +func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, getPrivatePathServiceGatewayEndpointGatewayBindingOptions *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) (result *PrivatePathServiceGatewayEndpointGatewayBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPrivatePathServiceGatewayEndpointGatewayBindingOptions, "getPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getPrivatePathServiceGatewayEndpointGatewayBindingOptions, "getPrivatePathServiceGatewayEndpointGatewayBindingOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *getPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, + "id": *getPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "get_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DenyPrivatePathServiceGatewayEndpointGatewayBinding : Deny an endpoint gateway binding for a private path service gateway +// This request denies a `pending` endpoint gateway request, and optionally sets the policy to deny future requests from +// the same account. +func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBinding(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), denyPrivatePathServiceGatewayEndpointGatewayBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the DenyPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter +func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, denyPrivatePathServiceGatewayEndpointGatewayBindingOptions *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, + "id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/deny`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DenyPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + body := make(map[string]interface{}) + if denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy != nil { + body["set_account_policy"] = denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "deny_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// PermitPrivatePathServiceGatewayEndpointGatewayBinding : Permit an endpoint gateway binding for a private path service gateway +// This request permits a `pending` endpoint gateway request, and optionally sets the policy to permit future requests +// from the same account. +func (vpc *VpcV1) PermitPrivatePathServiceGatewayEndpointGatewayBinding(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), permitPrivatePathServiceGatewayEndpointGatewayBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the PermitPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter +func (vpc *VpcV1) PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, permitPrivatePathServiceGatewayEndpointGatewayBindingOptions *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions, "permitPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions, "permitPrivatePathServiceGatewayEndpointGatewayBindingOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, + "id": *permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/permit`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PermitPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + body := make(map[string]interface{}) + if permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy != nil { + body["set_account_policy"] = permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "permit_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// PublishPrivatePathServiceGateway : Publish a private path service gateway +// This request publishes a private path service gateway, allowing any account to request access to it. +func (vpc *VpcV1) PublishPrivatePathServiceGateway(publishPrivatePathServiceGatewayOptions *PublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.PublishPrivatePathServiceGatewayWithContext(context.Background(), publishPrivatePathServiceGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// PublishPrivatePathServiceGatewayWithContext is an alternate form of the PublishPrivatePathServiceGateway method which supports a Context parameter +func (vpc *VpcV1) PublishPrivatePathServiceGatewayWithContext(ctx context.Context, publishPrivatePathServiceGatewayOptions *PublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *publishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/publish`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range publishPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PublishPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "publish_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// RevokeAccountForPrivatePathServiceGateway : Revoke access to a private path service gateway for an account +// This request revokes a consumer account. This operation cannot be reversed. The `status` of all endpoint gateway +// bindings associated with the specified private path service gateway become `denied`. If the specified account has an +// existing access policy, that policy will be updated to `denied`. Otherwise, a new `deny` access policy will be +// created for the account. +func (vpc *VpcV1) RevokeAccountForPrivatePathServiceGateway(revokeAccountForPrivatePathServiceGatewayOptions *RevokeAccountForPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RevokeAccountForPrivatePathServiceGatewayWithContext(context.Background(), revokeAccountForPrivatePathServiceGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// RevokeAccountForPrivatePathServiceGatewayWithContext is an alternate form of the RevokeAccountForPrivatePathServiceGateway method which supports a Context parameter +func (vpc *VpcV1) RevokeAccountForPrivatePathServiceGatewayWithContext(ctx context.Context, revokeAccountForPrivatePathServiceGatewayOptions *RevokeAccountForPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(revokeAccountForPrivatePathServiceGatewayOptions, "revokeAccountForPrivatePathServiceGatewayOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(revokeAccountForPrivatePathServiceGatewayOptions, "revokeAccountForPrivatePathServiceGatewayOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *revokeAccountForPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/revoke_account`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range revokeAccountForPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RevokeAccountForPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + body := make(map[string]interface{}) + if revokeAccountForPrivatePathServiceGatewayOptions.Account != nil { + body["account"] = revokeAccountForPrivatePathServiceGatewayOptions.Account + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "revoke_account_for_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// UnpublishPrivatePathServiceGateway : Unpublish a private path service gateway +// This request unpublishes a private path service gateway. For this request to succeed, any existing access from other +// accounts must first be revoked. Once unpublished, access will again be restricted to the account that created this +// private path service gateway. +func (vpc *VpcV1) UnpublishPrivatePathServiceGateway(unpublishPrivatePathServiceGatewayOptions *UnpublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.UnpublishPrivatePathServiceGatewayWithContext(context.Background(), unpublishPrivatePathServiceGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UnpublishPrivatePathServiceGatewayWithContext is an alternate form of the UnpublishPrivatePathServiceGateway method which supports a Context parameter +func (vpc *VpcV1) UnpublishPrivatePathServiceGatewayWithContext(ctx context.Context, unpublishPrivatePathServiceGatewayOptions *UnpublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unpublishPrivatePathServiceGatewayOptions, "unpublishPrivatePathServiceGatewayOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(unpublishPrivatePathServiceGatewayOptions, "unpublishPrivatePathServiceGatewayOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *unpublishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/unpublish`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range unpublishPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnpublishPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "unpublish_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} +func getServiceComponentInfo() *core.ProblemComponent { + return core.NewProblemComponent(DefaultServiceName, "2024-11-12") +} + +// AccountIdentity : Identifies an account by a unique property. +// Models which "extend" this model: +// - AccountIdentityByID +type AccountIdentity struct { + // The unique identifier for this account. + ID *string `json:"id,omitempty"` +} + +func (*AccountIdentity) isaAccountIdentity() bool { + return true +} + +type AccountIdentityIntf interface { + isaAccountIdentity() bool +} + +// UnmarshalAccountIdentity unmarshals an instance of AccountIdentity from the specified map of raw messages. +func UnmarshalAccountIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccountIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AccountReference : AccountReference struct +type AccountReference struct { + // The unique identifier for this account. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the AccountReference.ResourceType property. +// The resource type. +const ( + AccountReferenceResourceTypeAccountConst = "account" +) + +// UnmarshalAccountReference unmarshals an instance of AccountReference from the specified map of raw messages. +func UnmarshalAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccountReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ActivateReservationOptions : The ActivateReservation options. +type ActivateReservationOptions struct { + // The reservation identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewActivateReservationOptions : Instantiate ActivateReservationOptions +func (*VpcV1) NewActivateReservationOptions(id string) *ActivateReservationOptions { + return &ActivateReservationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ActivateReservationOptions) SetID(id string) *ActivateReservationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ActivateReservationOptions) SetHeaders(param map[string]string) *ActivateReservationOptions { + options.Headers = param + return options +} + +// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. +type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewAddBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate AddBareMetalServerNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + return &AddBareMetalServerNetworkInterfaceFloatingIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// AddEndpointGatewayIPOptions : The AddEndpointGatewayIP options. +type AddEndpointGatewayIPOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewAddEndpointGatewayIPOptions : Instantiate AddEndpointGatewayIPOptions +func (*VpcV1) NewAddEndpointGatewayIPOptions(endpointGatewayID string, id string) *AddEndpointGatewayIPOptions { + return &AddEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *AddEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *AddEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddEndpointGatewayIPOptions) SetID(id string) *AddEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddEndpointGatewayIPOptions) SetHeaders(param map[string]string) *AddEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. +type AddInstanceNetworkInterfaceFloatingIPOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewAddInstanceNetworkInterfaceFloatingIPOptions : Instantiate AddInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *AddInstanceNetworkInterfaceFloatingIPOptions { + return &AddInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// AddNetworkInterfaceFloatingIPOptions : The AddNetworkInterfaceFloatingIP options. +type AddNetworkInterfaceFloatingIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewAddNetworkInterfaceFloatingIPOptions : Instantiate AddNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *AddNetworkInterfaceFloatingIPOptions { + return &AddNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *AddNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddNetworkInterfaceFloatingIPOptions) SetID(id string) *AddNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// AddVirtualNetworkInterfaceIPOptions : The AddVirtualNetworkInterfaceIP options. +type AddVirtualNetworkInterfaceIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewAddVirtualNetworkInterfaceIPOptions : Instantiate AddVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewAddVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *AddVirtualNetworkInterfaceIPOptions { + return &AddVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *AddVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVirtualNetworkInterfaceIPOptions) SetID(id string) *AddVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *AddVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionsLocalCIDROptions : The AddVPNGatewayConnectionsLocalCIDR options. +type AddVPNGatewayConnectionsLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The IP address range in CIDR block notation. + CIDR *string `json:"cidr" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewAddVPNGatewayConnectionsLocalCIDROptions : Instantiate AddVPNGatewayConnectionsLocalCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *AddVPNGatewayConnectionsLocalCIDROptions { + return &AddVPNGatewayConnectionsLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDR: core.StringPtr(cidr), + } +} // SetVPNGatewayID : Allow user to set VPNGatewayID func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionsLocalCIDROptions { @@ -31719,107 +33926,1096 @@ func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGat return _options } -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionsLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionsLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *AddVPNGatewayConnectionsLocalCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsLocalCIDROptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionsPeerCIDROptions : The AddVPNGatewayConnectionsPeerCIDR options. +type AddVPNGatewayConnectionsPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The IP address range in CIDR block notation. + CIDR *string `json:"cidr" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewAddVPNGatewayConnectionsPeerCIDROptions : Instantiate AddVPNGatewayConnectionsPeerCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *AddVPNGatewayConnectionsPeerCIDROptions { + return &AddVPNGatewayConnectionsPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDR: core.StringPtr(cidr), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionsPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionsPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *AddVPNGatewayConnectionsPeerCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsPeerCIDROptions { + options.Headers = param + return options +} + +// AddressPrefix : AddressPrefix struct +type AddressPrefix struct { + // The CIDR block for this prefix. + CIDR *string `json:"cidr" validate:"required"` + + // The date and time that the prefix was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Indicates whether subnets exist with addresses from this prefix. + HasSubnets *bool `json:"has_subnets" validate:"required"` + + // The URL for this address prefix. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this address prefix. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default prefix for this zone in this VPC. If a default prefix was automatically + // created when the VPC was created, the prefix is automatically named using a hyphenated list of randomly-selected + // words, but may be changed. + IsDefault *bool `json:"is_default" validate:"required"` + + // The name for this address prefix. The name must not be used by another address prefix for the VPC. + Name *string `json:"name" validate:"required"` + + // The zone this address prefix resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalAddressPrefix unmarshals an instance of AddressPrefix from the specified map of raw messages. +func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefix) + err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) + if err != nil { + err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) + if err != nil { + err = core.SDKErrorf(err, "", "has_subnets-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixCollection : AddressPrefixCollection struct +type AddressPrefixCollection struct { + // A page of address prefixes for the VPC. + AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` + + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalAddressPrefixCollection unmarshals an instance of AddressPrefixCollection from the specified map of raw messages. +func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollection) + err = core.UnmarshalModel(m, "address_prefixes", &obj.AddressPrefixes, UnmarshalAddressPrefix) + if err != nil { + err = core.SDKErrorf(err, "", "address_prefixes-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *AddressPrefixCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + +// AddressPrefixPatch : AddressPrefixPatch struct +type AddressPrefixPatch struct { + // Indicates whether this is the default prefix for this zone in this VPC. Updating to true makes this prefix the + // default prefix for this zone in this VPC, provided the VPC currently has no default address prefix for this zone. + // Updating to false removes the default prefix for this zone in this VPC. + IsDefault *bool `json:"is_default,omitempty"` + + // The name for this address prefix. The name must not be used by another address prefix for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalAddressPrefixPatch unmarshals an instance of AddressPrefixPatch from the specified map of raw messages. +func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixPatch) + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the AddressPrefixPatch +func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(addressPrefixPatch.IsDefault) { + _patch["is_default"] = addressPrefixPatch.IsDefault + } + if !core.IsNil(addressPrefixPatch.Name) { + _patch["name"] = addressPrefixPatch.Name + } + + return +} + +// BackupPolicy : BackupPolicy struct +// Models which "extend" this model: +// - BackupPolicyMatchResourceTypeInstance +// - BackupPolicyMatchResourceTypeVolume +type BackupPolicy struct { + // The date and time that the backup policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this backup policy. + CRN *string `json:"crn" validate:"required"` + + // The reasons for the current `health_state` (if any). + HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` + + // The health of this resource: + // - `ok`: No abnormal behavior detected + // - `degraded`: Experiencing compromised performance, capacity, or connectivity + // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated + // - `inapplicable`: The health state does not apply because of the current lifecycle + // state. A resource with a lifecycle state of `failed` or `deleting` will have a + // health state of `inapplicable`. A `pending` resource may also have this state. + HealthState *string `json:"health_state" validate:"required"` + + // The URL for this backup policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this backup policy. + ID *string `json:"id" validate:"required"` + + // The date and time that the most recent job for this backup policy completed. + // + // If absent, no job has yet completed for this backup policy. + LastJobCompletedAt *strfmt.DateTime `json:"last_job_completed_at,omitempty"` + + // The lifecycle state of the backup policy. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The resource type this backup policy applies to. Resources that have both a matching type and a matching user tag + // will be subject to the backup policy. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + MatchResourceType *string `json:"match_resource_type" validate:"required"` + + // The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will + // be subject to the backup policy. + MatchUserTags []string `json:"match_user_tags" validate:"required"` + + // The name for this backup policy. The name is unique across all backup policies in the region. + Name *string `json:"name" validate:"required"` + + // The plans for the backup policy. + Plans []BackupPolicyPlanReference `json:"plans" validate:"required"` + + // The resource group for this backup policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The scope for this backup policy. + Scope BackupPolicyScopeIntf `json:"scope" validate:"required"` + + // The included content for backups created using this policy: + // - `boot_volume`: Include the instance's boot volume. + // - `data_volumes`: Include the instance's data volumes. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + IncludedContent []string `json:"included_content,omitempty"` +} + +// Constants associated with the BackupPolicy.HealthState property. +// The health of this resource: +// - `ok`: No abnormal behavior detected +// - `degraded`: Experiencing compromised performance, capacity, or connectivity +// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated +// - `inapplicable`: The health state does not apply because of the current lifecycle +// state. A resource with a lifecycle state of `failed` or `deleting` will have a +// health state of `inapplicable`. A `pending` resource may also have this state. +const ( + BackupPolicyHealthStateDegradedConst = "degraded" + BackupPolicyHealthStateFaultedConst = "faulted" + BackupPolicyHealthStateInapplicableConst = "inapplicable" + BackupPolicyHealthStateOkConst = "ok" +) + +// Constants associated with the BackupPolicy.LifecycleState property. +// The lifecycle state of the backup policy. +const ( + BackupPolicyLifecycleStateDeletingConst = "deleting" + BackupPolicyLifecycleStateFailedConst = "failed" + BackupPolicyLifecycleStatePendingConst = "pending" + BackupPolicyLifecycleStateStableConst = "stable" + BackupPolicyLifecycleStateSuspendedConst = "suspended" + BackupPolicyLifecycleStateUpdatingConst = "updating" + BackupPolicyLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicy.MatchResourceType property. +// The resource type this backup policy applies to. Resources that have both a matching type and a matching user tag +// will be subject to the backup policy. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BackupPolicyMatchResourceTypeInstanceConst = "instance" + BackupPolicyMatchResourceTypeVolumeConst = "volume" +) + +// Constants associated with the BackupPolicy.ResourceType property. +// The resource type. +const ( + BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" +) + +// Constants associated with the BackupPolicy.IncludedContent property. +// An item to include. +const ( + BackupPolicyIncludedContentBootVolumeConst = "boot_volume" + BackupPolicyIncludedContentDataVolumesConst = "data_volumes" +) + +func (*BackupPolicy) isaBackupPolicy() bool { + return true +} + +type BackupPolicyIntf interface { + isaBackupPolicy() bool +} + +// UnmarshalBackupPolicy unmarshals an instance of BackupPolicy from the specified map of raw messages. +func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicy) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + if err != nil { + err = core.SDKErrorf(err, "", "last_job_completed_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if err != nil { + err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + err = core.SDKErrorf(err, "", "scope-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyCollection : BackupPolicyCollection struct +type BackupPolicyCollection struct { + // A page of backup policies. + BackupPolicies []BackupPolicyIntf `json:"backup_policies" validate:"required"` + + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBackupPolicyCollection unmarshals an instance of BackupPolicyCollection from the specified map of raw messages. +func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyCollection) + err = core.UnmarshalModel(m, "backup_policies", &obj.BackupPolicies, UnmarshalBackupPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "backup_policies-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil } -// SetCIDR : Allow user to set CIDR -func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *AddVPNGatewayConnectionsLocalCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options +// BackupPolicyHealthReason : BackupPolicyHealthReason struct +type BackupPolicyHealthReason struct { + // A reason code for this health state. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this health state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this health state. + MoreInfo *string `json:"more_info,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsLocalCIDROptions { - options.Headers = param - return options +// Constants associated with the BackupPolicyHealthReason.Code property. +// A reason code for this health state. +const ( + BackupPolicyHealthReasonCodeMissingServiceAuthorizationPoliciesConst = "missing_service_authorization_policies" +) + +// UnmarshalBackupPolicyHealthReason unmarshals an instance of BackupPolicyHealthReason from the specified map of raw messages. +func UnmarshalBackupPolicyHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// AddVPNGatewayConnectionsPeerCIDROptions : The AddVPNGatewayConnectionsPeerCIDR options. -type AddVPNGatewayConnectionsPeerCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` +// BackupPolicyJob : BackupPolicyJob struct +type BackupPolicyJob struct { + // Indicates whether this backup policy job will be automatically deleted after it completes. At present, this is + // always `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` + // If `auto_delete` is `true`, the days after completion that this backup policy job will be deleted. This value may be + // modifiable in the future. + AutoDeleteAfter *int64 `json:"auto_delete_after" validate:"required"` - // The IP address range in CIDR block notation. - CIDR *string `json:"cidr" validate:"required,ne="` + // The backup policy plan operated this backup policy job (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string + // The date and time that the backup policy job was completed. + // + // If absent, the backup policy job has not yet completed. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the backup policy job was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this backup policy job. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this backup policy job. + ID *string `json:"id" validate:"required"` + + // The type of backup policy job. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + JobType *string `json:"job_type" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The source this backup was created from (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + Source BackupPolicyJobSourceIntf `json:"source" validate:"required"` + + // The status of the backup policy job. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"` + + // The snapshots operated on by this backup policy job (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + TargetSnapshots []SnapshotReference `json:"target_snapshots" validate:"required"` } -// NewAddVPNGatewayConnectionsPeerCIDROptions : Instantiate AddVPNGatewayConnectionsPeerCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *AddVPNGatewayConnectionsPeerCIDROptions { - return &AddVPNGatewayConnectionsPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDR: core.StringPtr(cidr), +// Constants associated with the BackupPolicyJob.JobType property. +// The type of backup policy job. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BackupPolicyJobJobTypeCreationConst = "creation" + BackupPolicyJobJobTypeDeletionConst = "deletion" +) + +// Constants associated with the BackupPolicyJob.ResourceType property. +// The resource type. +const ( + BackupPolicyJobResourceTypeBackupPolicyJobConst = "backup_policy_job" +) + +// Constants associated with the BackupPolicyJob.Status property. +// The status of the backup policy job. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BackupPolicyJobStatusFailedConst = "failed" + BackupPolicyJobStatusRunningConst = "running" + BackupPolicyJobStatusSucceededConst = "succeeded" +) + +// UnmarshalBackupPolicyJob unmarshals an instance of BackupPolicyJob from the specified map of raw messages. +func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJob) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter) + if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_after-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + err = core.SDKErrorf(err, "", "backup_policy_plan-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + err = core.SDKErrorf(err, "", "completed_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) + if err != nil { + err = core.SDKErrorf(err, "", "job_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource) + if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason) + if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) + if err != nil { + err = core.SDKErrorf(err, "", "target_snapshots-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionsPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options +// BackupPolicyJobCollection : BackupPolicyJobCollection struct +type BackupPolicyJobCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // A page of jobs for the backup policy. + Jobs []BackupPolicyJob `json:"jobs" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionsPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options +// UnmarshalBackupPolicyJobCollection unmarshals an instance of BackupPolicyJobCollection from the specified map of raw messages. +func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) + if err != nil { + err = core.SDKErrorf(err, "", "jobs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetCIDR : Allow user to set CIDR -func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *AddVPNGatewayConnectionsPeerCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil } -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsPeerCIDROptions { - options.Headers = param - return options +// BackupPolicyJobSource : The source this backup was created from (may be +// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). +// Models which "extend" this model: +// - BackupPolicyJobSourceVolumeReference +// - BackupPolicyJobSourceInstanceReference +type BackupPolicyJobSource struct { + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` + + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name,omitempty"` + + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` } -// AddressPrefix : AddressPrefix struct -type AddressPrefix struct { - // The CIDR block for this prefix. - CIDR *string `json:"cidr" validate:"required"` +// Constants associated with the BackupPolicyJobSource.ResourceType property. +// The resource type. +const ( + BackupPolicyJobSourceResourceTypeVolumeConst = "volume" +) - // The date and time that the prefix was created. +func (*BackupPolicyJobSource) isaBackupPolicyJobSource() bool { + return true +} + +type BackupPolicyJobSourceIntf interface { + isaBackupPolicyJobSource() bool +} + +// UnmarshalBackupPolicyJobSource unmarshals an instance of BackupPolicyJobSource from the specified map of raw messages. +func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobSource) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct +type BackupPolicyJobStatusReason struct { + // A reason code for the status: + // - `internal_error`: Internal error (contact IBM support) + // - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable + // - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state + // - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached + // - `source_volume_busy`: The source volume has `busy` set (after multiple retries) + // - `source_volume_too_large`: The source volume exceeds the [maximum supported + // size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations) + // - `source_volume_unavailable`: The source volume is not attached to a running instance + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the BackupPolicyJobStatusReason.Code property. +// A reason code for the status: +// - `internal_error`: Internal error (contact IBM support) +// - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable +// - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state +// - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached +// - `source_volume_busy`: The source volume has `busy` set (after multiple retries) +// - `source_volume_too_large`: The source volume exceeds the [maximum supported +// size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations) +// - `source_volume_unavailable`: The source volume is not attached to a running instance +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" + BackupPolicyJobStatusReasonCodeSnapshotEncryptionKeyInvalidConst = "snapshot_encryption_key_invalid" + BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" + BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" + BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" + BackupPolicyJobStatusReasonCodeSourceVolumeTooLargeConst = "source_volume_too_large" + BackupPolicyJobStatusReasonCodeSourceVolumeUnavailableConst = "source_volume_unavailable" +) + +// UnmarshalBackupPolicyJobStatusReason unmarshals an instance of BackupPolicyJobStatusReason from the specified map of raw messages. +func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPatch : BackupPolicyPatch struct +type BackupPolicyPatch struct { + // The included content for backups created using this policy: + // - `boot_volume`: Include the instance's boot volume. + // - `data_volumes`: Include the instance's data volumes. + IncludedContent []string `json:"included_content,omitempty"` + + // The user tags this backup policy will apply to (replacing any existing tags). Resources that have both a matching + // user tag and a matching type will be subject to the backup policy. + MatchUserTags []string `json:"match_user_tags,omitempty"` + + // The name for this backup policy. The name must not be used by another backup policy in the region. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the BackupPolicyPatch.IncludedContent property. +// An item to include. +const ( + BackupPolicyPatchIncludedContentBootVolumeConst = "boot_volume" + BackupPolicyPatchIncludedContentDataVolumesConst = "data_volumes" +) + +// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPatch) + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BackupPolicyPatch +func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPatch.IncludedContent) { + _patch["included_content"] = backupPolicyPatch.IncludedContent + } + if !core.IsNil(backupPolicyPatch.MatchUserTags) { + _patch["match_user_tags"] = backupPolicyPatch.MatchUserTags + } + if !core.IsNil(backupPolicyPatch.Name) { + _patch["name"] = backupPolicyPatch.Name + } + + return +} + +// BackupPolicyPlan : BackupPolicyPlan struct +type BackupPolicyPlan struct { + // Indicates whether the plan is active. + Active *bool `json:"active" validate:"required"` + + // The user tags to attach to backups (snapshots) created by this plan. + AttachUserTags []string `json:"attach_user_tags" validate:"required"` + + ClonePolicy *BackupPolicyPlanClonePolicy `json:"clone_policy" validate:"required"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags" validate:"required"` + + // The date and time that the backup policy plan was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // Indicates whether subnets exist with addresses from this prefix. - HasSubnets *bool `json:"has_subnets" validate:"required"` + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` - // The URL for this address prefix. + DeletionTrigger *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"` + + // The URL for this backup policy plan. Href *string `json:"href" validate:"required"` - // The unique identifier for this address prefix. + // The unique identifier for this backup policy plan. ID *string `json:"id" validate:"required"` - // Indicates whether this is the default prefix for this zone in this VPC. If a default prefix was automatically - // created when the VPC was created, the prefix is automatically named using a hyphenated list of randomly-selected - // words, but may be changed. - IsDefault *bool `json:"is_default" validate:"required"` + // The lifecycle state of this backup policy plan. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this address prefix. The name must not be used by another address prefix for the VPC. + // The name for this backup policy plan. The name is unique across all plans in the backup policy. Name *string `json:"name" validate:"required"` - // The zone this address prefix resides in. - Zone *ZoneReference `json:"zone" validate:"required"` + // The policies for additional backups in remote regions. + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicy `json:"remote_region_policies" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// UnmarshalAddressPrefix unmarshals an instance of AddressPrefix from the specified map of raw messages. -func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefix) - err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) +// Constants associated with the BackupPolicyPlan.LifecycleState property. +// The lifecycle state of this backup policy plan. +const ( + BackupPolicyPlanLifecycleStateDeletingConst = "deleting" + BackupPolicyPlanLifecycleStateFailedConst = "failed" + BackupPolicyPlanLifecycleStatePendingConst = "pending" + BackupPolicyPlanLifecycleStateStableConst = "stable" + BackupPolicyPlanLifecycleStateSuspendedConst = "suspended" + BackupPolicyPlanLifecycleStateUpdatingConst = "updating" + BackupPolicyPlanLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicyPlan.ResourceType property. +// The resource type. +const ( + BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan" +) + +// UnmarshalBackupPolicyPlan unmarshals an instance of BackupPolicyPlan from the specified map of raw messages. +func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlan) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { - err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy) + if err != nil { + err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) @@ -31827,24 +35023,485 @@ func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) + if err != nil { + err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanClonePolicy : BackupPolicyPlanClonePolicy struct +type BackupPolicyPlanClonePolicy struct { + // The maximum number of recent snapshots (per source) that will keep clones. + MaxSnapshots *int64 `json:"max_snapshots" validate:"required"` + + // The zone this backup policy plan will create snapshot clones in. + Zones []ZoneReference `json:"zones" validate:"required"` +} + +// UnmarshalBackupPolicyPlanClonePolicy unmarshals an instance of BackupPolicyPlanClonePolicy from the specified map of raw messages. +func UnmarshalBackupPolicyPlanClonePolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanClonePolicy) + err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + if err != nil { + err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) + if err != nil { + err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanClonePolicyPatch : BackupPolicyPlanClonePolicyPatch struct +type BackupPolicyPlanClonePolicyPatch struct { + // The maximum number of recent snapshots (per source) that will keep clones. + MaxSnapshots *int64 `json:"max_snapshots,omitempty"` + + // The zones this backup policy plan will create snapshot clones in. Updating this value does not change the clones for + // snapshots that have already been created by this plan. + Zones []ZoneIdentityIntf `json:"zones,omitempty"` +} + +// UnmarshalBackupPolicyPlanClonePolicyPatch unmarshals an instance of BackupPolicyPlanClonePolicyPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanClonePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanClonePolicyPatch) + err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + if err != nil { + err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the BackupPolicyPlanClonePolicyPatch +func (backupPolicyPlanClonePolicyPatch *BackupPolicyPlanClonePolicyPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPlanClonePolicyPatch.MaxSnapshots) { + _patch["max_snapshots"] = backupPolicyPlanClonePolicyPatch.MaxSnapshots + } + if !core.IsNil(backupPolicyPlanClonePolicyPatch.Zones) { + var zonesPatches []map[string]interface{} + for _, zones := range backupPolicyPlanClonePolicyPatch.Zones { + zonesPatches = append(zonesPatches, zones.asPatch()) + } + _patch["zones"] = zonesPatches + } + + return +} + +// BackupPolicyPlanClonePolicyPrototype : BackupPolicyPlanClonePolicyPrototype struct +type BackupPolicyPlanClonePolicyPrototype struct { + // The maximum number of recent snapshots (per source) that will keep clones. + MaxSnapshots *int64 `json:"max_snapshots,omitempty"` + + // The zone this backup policy plan will create snapshot clones in. + Zones []ZoneIdentityIntf `json:"zones" validate:"required"` +} + +// NewBackupPolicyPlanClonePolicyPrototype : Instantiate BackupPolicyPlanClonePolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) (_model *BackupPolicyPlanClonePolicyPrototype, err error) { + _model = &BackupPolicyPlanClonePolicyPrototype{ + Zones: zones, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalBackupPolicyPlanClonePolicyPrototype unmarshals an instance of BackupPolicyPlanClonePolicyPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanClonePolicyPrototype) + err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + if err != nil { + err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct +type BackupPolicyPlanCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // A page of plans for the backup policy. + Plans []BackupPolicyPlan `json:"plans" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages. +func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) + if err != nil { + err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct +type BackupPolicyPlanDeletionTrigger struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after" validate:"required"` + + // The maximum number of recent backups to keep. If absent, there is no maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTrigger) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct +type BackupPolicyPlanDeletionTriggerPatch struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` + + // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTriggerPatch) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the BackupPolicyPlanDeletionTriggerPatch +func (backupPolicyPlanDeletionTriggerPatch *BackupPolicyPlanDeletionTriggerPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPlanDeletionTriggerPatch.DeleteAfter) { + _patch["delete_after"] = backupPolicyPlanDeletionTriggerPatch.DeleteAfter + } + if !core.IsNil(backupPolicyPlanDeletionTriggerPatch.DeleteOverCount) { + _patch["delete_over_count"] = backupPolicyPlanDeletionTriggerPatch.DeleteOverCount + } + + return +} + +// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct +type BackupPolicyPlanDeletionTriggerPrototype struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` + + // The maximum number of recent backups to keep. If unspecified, there will be no maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +} + +// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTriggerPrototype) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct +type BackupPolicyPlanPatch struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` + + // The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user + // tags for backups that have already been created by this plan. + AttachUserTags []string `json:"attach_user_tags,omitempty"` + + ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec,omitempty"` + + DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` + + // The name for this backup policy plan. The name must not be used by another plan for the backup policy. + Name *string `json:"name,omitempty"` + + // The policies for additional backups in remote regions (replacing any existing policies). + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` +} + +// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) + if err != nil { + err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) + if err != nil { + err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BackupPolicyPlanPatch +func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPlanPatch.Active) { + _patch["active"] = backupPolicyPlanPatch.Active + } + if !core.IsNil(backupPolicyPlanPatch.AttachUserTags) { + _patch["attach_user_tags"] = backupPolicyPlanPatch.AttachUserTags + } + if !core.IsNil(backupPolicyPlanPatch.ClonePolicy) { + _patch["clone_policy"] = backupPolicyPlanPatch.ClonePolicy.asPatch() + } + if !core.IsNil(backupPolicyPlanPatch.CopyUserTags) { + _patch["copy_user_tags"] = backupPolicyPlanPatch.CopyUserTags + } + if !core.IsNil(backupPolicyPlanPatch.CronSpec) { + _patch["cron_spec"] = backupPolicyPlanPatch.CronSpec + } + if !core.IsNil(backupPolicyPlanPatch.DeletionTrigger) { + _patch["deletion_trigger"] = backupPolicyPlanPatch.DeletionTrigger.asPatch() + } + if !core.IsNil(backupPolicyPlanPatch.Name) { + _patch["name"] = backupPolicyPlanPatch.Name + } + if !core.IsNil(backupPolicyPlanPatch.RemoteRegionPolicies) { + var remoteRegionPoliciesPatches []map[string]interface{} + for _, remoteRegionPolicies := range backupPolicyPlanPatch.RemoteRegionPolicies { + remoteRegionPoliciesPatches = append(remoteRegionPoliciesPatches, remoteRegionPolicies.asPatch()) + } + _patch["remote_region_policies"] = remoteRegionPoliciesPatches + } + + return +} + +// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct +type BackupPolicyPlanPrototype struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` + + // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. + AttachUserTags []string `json:"attach_user_tags,omitempty"` + + ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` + + DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` + + // The name for this backup policy plan. The name must not be used by another plan for the backup policy. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The policies for additional backups in remote regions. + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` +} + +// NewBackupPolicyPlanPrototype : Instantiate BackupPolicyPlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolicyPlanPrototype, err error) { + _model = &BackupPolicyPlanPrototype{ + CronSpec: core.StringPtr(cronSpec), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalBackupPolicyPlanPrototype unmarshals an instance of BackupPolicyPlanPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanPrototype) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) if err != nil { - err = core.SDKErrorf(err, "", "has_subnets-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) if err != nil { - err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -31852,134 +35509,269 @@ func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AddressPrefixCollection : AddressPrefixCollection struct -type AddressPrefixCollection struct { - // A page of address prefixes for the VPC. - AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` +// BackupPolicyPlanReference : BackupPolicyPlanReference struct +type BackupPolicyPlanReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` - // A link to the first page of resources. - First *AddressPrefixCollectionFirst `json:"first" validate:"required"` + // The URL for this backup policy plan. + Href *string `json:"href" validate:"required"` - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + // The unique identifier for this backup policy plan. + ID *string `json:"id" validate:"required"` - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *AddressPrefixCollectionNext `json:"next,omitempty"` + // The name for this backup policy plan. The name is unique across all plans in the backup policy. + Name *string `json:"name" validate:"required"` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` + // If present, this property indicates that the resource associated with this reference + // is remote and therefore may not be directly retrievable. + Remote *BackupPolicyPlanRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// UnmarshalAddressPrefixCollection unmarshals an instance of AddressPrefixCollection from the specified map of raw messages. -func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollection) - err = core.UnmarshalModel(m, "address_prefixes", &obj.AddressPrefixes, UnmarshalAddressPrefix) +// Constants associated with the BackupPolicyPlanReference.ResourceType property. +// The resource type. +const ( + BackupPolicyPlanReferenceResourceTypeBackupPolicyPlanConst = "backup_policy_plan" +) + +// UnmarshalBackupPolicyPlanReference unmarshals an instance of BackupPolicyPlanReference from the specified map of raw messages. +func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { - err = core.SDKErrorf(err, "", "address_prefixes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote) if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// Retrieve the value to be passed to a request to access the next page of results -func (resp *AddressPrefixCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") +// BackupPolicyPlanRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type BackupPolicyPlanRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalBackupPolicyPlanRemote unmarshals an instance of BackupPolicyPlanRemote from the specified map of raw messages. +func UnmarshalBackupPolicyPlanRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) + return } - return start, nil + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// AddressPrefixCollectionFirst : A link to the first page of resources. -type AddressPrefixCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` +// BackupPolicyPlanRemoteRegionPolicy : BackupPolicyPlanRemoteRegionPolicy struct +type BackupPolicyPlanRemoteRegionPolicy struct { + // The region this backup policy plan will create backups in. + DeleteOverCount *int64 `json:"delete_over_count" validate:"required"` + + // The root key used to rewrap the data encryption key for the backup (snapshot). + EncryptionKey *EncryptionKeyReference `json:"encryption_key" validate:"required"` + + // The region this backup policy plan will create backups in. + Region *RegionReference `json:"region" validate:"required"` } -// UnmarshalAddressPrefixCollectionFirst unmarshals an instance of AddressPrefixCollectionFirst from the specified map of raw messages. -func UnmarshalAddressPrefixCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalBackupPolicyPlanRemoteRegionPolicy unmarshals an instance of BackupPolicyPlanRemoteRegionPolicy from the specified map of raw messages. +func UnmarshalBackupPolicyPlanRemoteRegionPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanRemoteRegionPolicy) + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AddressPrefixCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type AddressPrefixCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` +// BackupPolicyPlanRemoteRegionPolicyPrototype : BackupPolicyPlanRemoteRegionPolicyPrototype struct +type BackupPolicyPlanRemoteRegionPolicyPrototype struct { + // The region this backup policy plan will create backups in. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` + + // The root key to use to rewrap the data encryption key for the backup (snapshot). + // + // If unspecified, the source's `encryption_key` will be used. + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The region this backup policy plan will create backups in. + Region RegionIdentityIntf `json:"region" validate:"required"` } -// UnmarshalAddressPrefixCollectionNext unmarshals an instance of AddressPrefixCollectionNext from the specified map of raw messages. -func UnmarshalAddressPrefixCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// NewBackupPolicyPlanRemoteRegionPolicyPrototype : Instantiate BackupPolicyPlanRemoteRegionPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanRemoteRegionPolicyPrototype(region RegionIdentityIntf) (_model *BackupPolicyPlanRemoteRegionPolicyPrototype, err error) { + _model = &BackupPolicyPlanRemoteRegionPolicyPrototype{ + Region: region, + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype unmarshals an instance of BackupPolicyPlanRemoteRegionPolicyPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanRemoteRegionPolicyPrototype) + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AddressPrefixPatch : AddressPrefixPatch struct -type AddressPrefixPatch struct { - // Indicates whether this is the default prefix for this zone in this VPC. Updating to true makes this prefix the - // default prefix for this zone in this VPC, provided the VPC currently has no default address prefix for this zone. - // Updating to false removes the default prefix for this zone in this VPC. - IsDefault *bool `json:"is_default,omitempty"` +// asPatch returns a generic map representation of the BackupPolicyPlanRemoteRegionPolicyPrototype +func (backupPolicyPlanRemoteRegionPolicyPrototype *BackupPolicyPlanRemoteRegionPolicyPrototype) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPlanRemoteRegionPolicyPrototype.DeleteOverCount) { + _patch["delete_over_count"] = backupPolicyPlanRemoteRegionPolicyPrototype.DeleteOverCount + } + if !core.IsNil(backupPolicyPlanRemoteRegionPolicyPrototype.EncryptionKey) { + _patch["encryption_key"] = backupPolicyPlanRemoteRegionPolicyPrototype.EncryptionKey.asPatch() + } + if !core.IsNil(backupPolicyPlanRemoteRegionPolicyPrototype.Region) { + _patch["region"] = backupPolicyPlanRemoteRegionPolicyPrototype.Region.asPatch() + } - // The name for this address prefix. The name must not be used by another address prefix for the VPC. + return +} + +// BackupPolicyPrototype : BackupPolicyPrototype struct +// Models which "extend" this model: +// - BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype +// - BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype +type BackupPolicyPrototype struct { + // The resource type this backup policy will apply to. Resources that have both a matching type and a matching user tag + // will be subject to the backup policy. + MatchResourceType *string `json:"match_resource_type" validate:"required"` + + // The user tags this backup policy will apply to. Resources that have both a matching user tag and a matching type + // will be subject to the backup policy. + MatchUserTags []string `json:"match_user_tags" validate:"required"` + + // The name for this backup policy. The name must not be used by another backup policy in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` + + // The prototype objects for backup plans to be created for this backup policy. + Plans []BackupPolicyPlanPrototype `json:"plans,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The scope to use for this backup policy. + // + // If unspecified, the policy will be scoped to the account. + Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"` + + // The included content for backups created using this policy: + // - `boot_volume`: Include the instance's boot volume. + // - `data_volumes`: Include the instance's data volumes. + IncludedContent []string `json:"included_content,omitempty"` } -// UnmarshalAddressPrefixPatch unmarshals an instance of AddressPrefixPatch from the specified map of raw messages. -func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixPatch) - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) +// Constants associated with the BackupPolicyPrototype.MatchResourceType property. +// The resource type this backup policy will apply to. Resources that have both a matching type and a matching user tag +// will be subject to the backup policy. +const ( + BackupPolicyPrototypeMatchResourceTypeInstanceConst = "instance" + BackupPolicyPrototypeMatchResourceTypeVolumeConst = "volume" +) + +// Constants associated with the BackupPolicyPrototype.IncludedContent property. +// An item to include. +const ( + BackupPolicyPrototypeIncludedContentBootVolumeConst = "boot_volume" + BackupPolicyPrototypeIncludedContentDataVolumesConst = "data_volumes" +) + +func (*BackupPolicyPrototype) isaBackupPolicyPrototype() bool { + return true +} + +type BackupPolicyPrototypeIntf interface { + isaBackupPolicyPrototype() bool +} + +// UnmarshalBackupPolicyPrototype unmarshals an instance of BackupPolicyPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPrototype) + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) if err != nil { - err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -31987,157 +35779,281 @@ func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{ err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "scope-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the AddressPrefixPatch -func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(addressPrefixPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) +// BackupPolicyScope : The scope for this backup policy. +// Models which "extend" this model: +// - BackupPolicyScopeEnterpriseReference +// - BackupPolicyScopeAccountReference +type BackupPolicyScope struct { + // The CRN for this enterprise. + CRN *string `json:"crn,omitempty"` + + // The unique identifier for this enterprise. + ID *string `json:"id,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the BackupPolicyScope.ResourceType property. +// The resource type. +const ( + BackupPolicyScopeResourceTypeEnterpriseConst = "enterprise" +) + +func (*BackupPolicyScope) isaBackupPolicyScope() bool { + return true +} + +type BackupPolicyScopeIntf interface { + isaBackupPolicyScope() bool +} + +// UnmarshalBackupPolicyScope unmarshals an instance of BackupPolicyScope from the specified map of raw messages. +func UnmarshalBackupPolicyScope(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScope) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicy : BackupPolicy struct +// BackupPolicyScopePrototype : The scope to use for this backup policy. +// +// If unspecified, the policy will be scoped to the account. // Models which "extend" this model: -// - BackupPolicyMatchResourceTypeInstance -// - BackupPolicyMatchResourceTypeVolume -type BackupPolicy struct { - // The date and time that the backup policy was created. +// - BackupPolicyScopePrototypeEnterpriseIdentity +type BackupPolicyScopePrototype struct { + // The CRN for this enterprise. + CRN *string `json:"crn,omitempty"` +} + +func (*BackupPolicyScopePrototype) isaBackupPolicyScopePrototype() bool { + return true +} + +type BackupPolicyScopePrototypeIntf interface { + isaBackupPolicyScopePrototype() bool +} + +// UnmarshalBackupPolicyScopePrototype unmarshals an instance of BackupPolicyScopePrototype from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototype) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServer : BareMetalServer struct +type BareMetalServer struct { + // The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal + // server network interfaces. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // The resource from which this bare metal server is booted. + // + // The resources supported by this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"` + + // The bare metal server CPU configuration. + Cpu *BareMetalServerCpu `json:"cpu" validate:"required"` + + // The date and time that the bare metal server was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The CRN for this backup policy. + // The CRN for this bare metal server. CRN *string `json:"crn" validate:"required"` - // The reasons for the current `health_state` (if any). - HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` + // The disks for this bare metal server, including any disks that are associated with the + // `boot_target`. + Disks []BareMetalServerDisk `json:"disks" validate:"required"` - // The health of this resource: - // - `ok`: No abnormal behavior detected - // - `degraded`: Experiencing compromised performance, capacity, or connectivity - // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated - // - `inapplicable`: The health state does not apply because of the current lifecycle - // state. A resource with a lifecycle state of `failed` or `deleting` will have a - // health state of `inapplicable`. A `pending` resource may also have this state. - HealthState *string `json:"health_state" validate:"required"` + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to + // boot. + EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"` - // The URL for this backup policy. + // Firmware information for the bare metal server. + Firmware *BareMetalServerFirmware `json:"firmware" validate:"required"` + + // The URL for this bare metal server. Href *string `json:"href" validate:"required"` - // The unique identifier for this backup policy. + // The unique identifier for this bare metal server. ID *string `json:"id" validate:"required"` - // The date and time that the most recent job for this backup policy completed. - // - // If absent, no job has yet completed for this backup policy. - LastJobCompletedAt *strfmt.DateTime `json:"last_job_completed_at,omitempty"` + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` - // The lifecycle state of the backup policy. + // The lifecycle state of the bare metal server. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The resource type this backup policy applies to. Resources that have both a matching type and a matching user tag - // will be subject to the backup policy. + // The amount of memory, truncated to whole gibibytes. + Memory *int64 `json:"memory" validate:"required"` + + // The name for this bare metal server. The name is unique across all bare metal servers in the region. + Name *string `json:"name" validate:"required"` + + // The network attachments for this bare metal server, including the primary network attachment. + NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"` + + // The network interfaces for this bare metal server, including the primary network interface. // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - MatchResourceType *string `json:"match_resource_type" validate:"required"` + // If this bare metal server has network attachments, each network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface. + NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` - // The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will - // be subject to the backup policy. - MatchUserTags []string `json:"match_user_tags" validate:"required"` + // The primary network attachment for this bare metal server. + PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` - // The name for this backup policy. The name is unique across all backup policies in the region. - Name *string `json:"name" validate:"required"` + // The primary network interface for this bare metal server. + // + // If this bare metal server has network attachments, this primary network interface is + // a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) + // of the primary network attachment and its attached virtual network interface. + PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` - // The plans for the backup policy. - Plans []BackupPolicyPlanReference `json:"plans" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) + // for this bare metal server. + Profile *BareMetalServerProfileReference `json:"profile" validate:"required"` - // The resource group for this backup policy. + // The resource group for this bare metal server. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The scope for this backup policy. - Scope BackupPolicyScopeIntf `json:"scope" validate:"required"` - - // The included content for backups created using this policy: - // - `boot_volume`: Include the instance's boot volume. - // - `data_volumes`: Include the instance's data volumes. + // The status of this bare metal server: + // - `deleting`: server is undergoing deletion + // - `failed`: server is failed and not usable (see `status_reasons`) + // - `maintenance`: server is undergoing maintenance (not usable) + // - `pending`: server is being provisioned and not yet usable + // - `reinitializing`: server is reinitializing and not yet usable + // - `restarting`: server is restarting and not yet usable + // - `running`: server is powered on + // - `starting`: server is starting and not yet usable + // - `stopped`: server is powered off // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - IncludedContent []string `json:"included_content,omitempty"` + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"` + + // The VPC this bare metal server resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this bare metal server resides in. + Zone *ZoneReference `json:"zone" validate:"required"` } -// Constants associated with the BackupPolicy.HealthState property. -// The health of this resource: -// - `ok`: No abnormal behavior detected -// - `degraded`: Experiencing compromised performance, capacity, or connectivity -// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated -// - `inapplicable`: The health state does not apply because of the current lifecycle -// state. A resource with a lifecycle state of `failed` or `deleting` will have a -// health state of `inapplicable`. A `pending` resource may also have this state. +// Constants associated with the BareMetalServer.LifecycleState property. +// The lifecycle state of the bare metal server. const ( - BackupPolicyHealthStateDegradedConst = "degraded" - BackupPolicyHealthStateFaultedConst = "faulted" - BackupPolicyHealthStateInapplicableConst = "inapplicable" - BackupPolicyHealthStateOkConst = "ok" + BareMetalServerLifecycleStateDeletingConst = "deleting" + BareMetalServerLifecycleStateFailedConst = "failed" + BareMetalServerLifecycleStatePendingConst = "pending" + BareMetalServerLifecycleStateStableConst = "stable" + BareMetalServerLifecycleStateSuspendedConst = "suspended" + BareMetalServerLifecycleStateUpdatingConst = "updating" + BareMetalServerLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BackupPolicy.LifecycleState property. -// The lifecycle state of the backup policy. +// Constants associated with the BareMetalServer.ResourceType property. +// The resource type. const ( - BackupPolicyLifecycleStateDeletingConst = "deleting" - BackupPolicyLifecycleStateFailedConst = "failed" - BackupPolicyLifecycleStatePendingConst = "pending" - BackupPolicyLifecycleStateStableConst = "stable" - BackupPolicyLifecycleStateSuspendedConst = "suspended" - BackupPolicyLifecycleStateUpdatingConst = "updating" - BackupPolicyLifecycleStateWaitingConst = "waiting" + BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" ) -// Constants associated with the BackupPolicy.MatchResourceType property. -// The resource type this backup policy applies to. Resources that have both a matching type and a matching user tag -// will be subject to the backup policy. +// Constants associated with the BareMetalServer.Status property. +// The status of this bare metal server: +// - `deleting`: server is undergoing deletion +// - `failed`: server is failed and not usable (see `status_reasons`) +// - `maintenance`: server is undergoing maintenance (not usable) +// - `pending`: server is being provisioned and not yet usable +// - `reinitializing`: server is reinitializing and not yet usable +// - `restarting`: server is restarting and not yet usable +// - `running`: server is powered on +// - `starting`: server is starting and not yet usable +// - `stopped`: server is powered off // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BackupPolicyMatchResourceTypeInstanceConst = "instance" - BackupPolicyMatchResourceTypeVolumeConst = "volume" -) - -// Constants associated with the BackupPolicy.ResourceType property. -// The resource type. -const ( - BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" -) - -// Constants associated with the BackupPolicy.IncludedContent property. -// An item to include. -const ( - BackupPolicyIncludedContentBootVolumeConst = "boot_volume" - BackupPolicyIncludedContentDataVolumesConst = "data_volumes" + BareMetalServerStatusDeletingConst = "deleting" + BareMetalServerStatusFailedConst = "failed" + BareMetalServerStatusMaintenanceConst = "maintenance" + BareMetalServerStatusPendingConst = "pending" + BareMetalServerStatusReinitializingConst = "reinitializing" + BareMetalServerStatusRestartingConst = "restarting" + BareMetalServerStatusRunningConst = "running" + BareMetalServerStatusStartingConst = "starting" + BareMetalServerStatusStoppedConst = "stopped" ) -func (*BackupPolicy) isaBackupPolicy() bool { - return true -} - -type BackupPolicyIntf interface { - isaBackupPolicy() bool -} - -// UnmarshalBackupPolicy unmarshals an instance of BackupPolicy from the specified map of raw messages. -func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicy) +// UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages. +func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServer) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) + if err != nil { + err = core.SDKErrorf(err, "", "boot_target-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) + if err != nil { + err = core.SDKErrorf(err, "", "cpu-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -32148,14 +36064,19 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) if err != nil { - err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { - err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "firmware", &obj.Firmware, UnmarshalBareMetalServerFirmware) + if err != nil { + err = core.SDKErrorf(err, "", "firmware-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "href", &obj.Href) @@ -32168,9 +36089,9 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason) if err != nil { - err = core.SDKErrorf(err, "", "last_job_completed_at-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) @@ -32178,24 +36099,39 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) if err != nil { - err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { - err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) @@ -32208,48 +36144,175 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { - err = core.SDKErrorf(err, "", "scope-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) if err != nil { - err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) + if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyCollection : BackupPolicyCollection struct -type BackupPolicyCollection struct { - // A page of backup policies. - BackupPolicies []BackupPolicyIntf `json:"backup_policies" validate:"required"` +// BareMetalServerBootTarget : The resource from which this bare metal server is booted. +// +// The resources supported by this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +// Models which "extend" this model: +// - BareMetalServerBootTargetBareMetalServerDiskReference +type BareMetalServerBootTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this bare metal server disk. + Href *string `json:"href,omitempty"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id,omitempty"` + + // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the BareMetalServerBootTarget.ResourceType property. +// The resource type. +const ( + BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { + return true +} + +type BareMetalServerBootTargetIntf interface { + isaBareMetalServerBootTarget() bool +} + +// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages. +func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerBootTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCpu : The bare metal server CPU configuration. +type BareMetalServerCpu struct { + // The CPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The total number of cores. + CoreCount *int64 `json:"core_count" validate:"required"` + + // The total number of CPU sockets. + SocketCount *int64 `json:"socket_count" validate:"required"` + + // The total number of hardware threads per core. + ThreadsPerCore *int64 `json:"threads_per_core" validate:"required"` +} + +// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages. +func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) + if err != nil { + err = core.SDKErrorf(err, "", "core_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) + if err != nil { + err = core.SDKErrorf(err, "", "threads_per_core-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCollection : BareMetalServerCollection struct +type BareMetalServerCollection struct { + // A page of bare metal servers. + BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` // A link to the first page of resources. - First *BackupPolicyCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BackupPolicyCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBackupPolicyCollection unmarshals an instance of BackupPolicyCollection from the specified map of raw messages. -func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollection) - err = core.UnmarshalModel(m, "backup_policies", &obj.BackupPolicies, UnmarshalBackupPolicy) +// UnmarshalBareMetalServerCollection unmarshals an instance of BareMetalServerCollection from the specified map of raw messages. +func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCollection) + err = core.UnmarshalModel(m, "bare_metal_servers", &obj.BareMetalServers, UnmarshalBareMetalServer) if err != nil { - err = core.SDKErrorf(err, "", "backup_policies-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "bare_metal_servers-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -32259,7 +36322,7 @@ func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -32274,7 +36337,7 @@ func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interf } // Retrieve the value to be passed to a request to access the next page of results -func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { +func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -32288,187 +36351,125 @@ func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { return start, nil } -// BackupPolicyCollectionFirst : A link to the first page of resources. -type BackupPolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBackupPolicyCollectionFirst unmarshals an instance of BackupPolicyCollectionFirst from the specified map of raw messages. -func UnmarshalBackupPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} +// BareMetalServerConsoleAccessToken : The bare metal server console access token information. +type BareMetalServerConsoleAccessToken struct { + // A URL safe single-use token used to access the console WebSocket. + AccessToken *string `json:"access_token" validate:"required"` -// BackupPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BackupPolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} + // The bare metal server console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` -// UnmarshalBackupPolicyCollectionNext unmarshals an instance of BackupPolicyCollectionNext from the specified map of raw messages. -func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` -// BackupPolicyHealthReason : BackupPolicyHealthReason struct -type BackupPolicyHealthReason struct { - // A reason code for this health state. - Code *string `json:"code" validate:"required"` + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` + // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has + // no effect on VNC consoles. + Force *bool `json:"force" validate:"required"` - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` + // The URL to access this bare metal server console. + Href *string `json:"href" validate:"required"` } -// Constants associated with the BackupPolicyHealthReason.Code property. -// A reason code for this health state. +// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. +// The bare metal server console type for which this token may be used. const ( - BackupPolicyHealthReasonCodeMissingServiceAuthorizationPoliciesConst = "missing_service_authorization_policies" + BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" + BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" ) -// UnmarshalBackupPolicyHealthReason unmarshals an instance of BackupPolicyHealthReason from the specified map of raw messages. -func UnmarshalBackupPolicyHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyHealthReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) +// UnmarshalBareMetalServerConsoleAccessToken unmarshals an instance of BareMetalServerConsoleAccessToken from the specified map of raw messages. +func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerConsoleAccessToken) + err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) if err != nil { - err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "console_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + err = core.SDKErrorf(err, "", "expires_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + err = core.SDKErrorf(err, "", "force-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyJob : BackupPolicyJob struct -type BackupPolicyJob struct { - // Indicates whether this backup policy job will be automatically deleted after it completes. At present, this is - // always `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // If `auto_delete` is `true`, the days after completion that this backup policy job will be deleted. This value may be - // modifiable in the future. - AutoDeleteAfter *int64 `json:"auto_delete_after" validate:"required"` - - // The backup policy plan operated this backup policy job (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan" validate:"required"` - - // The date and time that the backup policy job was completed. - // - // If absent, the backup policy job has not yet completed. - CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` - - // The date and time that the backup policy job was created. +// BareMetalServerDisk : BareMetalServerDisk struct +type BareMetalServerDisk struct { + // The date and time that the disk was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this backup policy job. + // The URL for this bare metal server disk. Href *string `json:"href" validate:"required"` - // The unique identifier for this backup policy job. + // The unique identifier for this bare metal server disk. ID *string `json:"id" validate:"required"` - // The type of backup policy job. + // The disk attachment interface used: + // - `fcp`: Fiber Channel Protocol + // - `sata`: Serial Advanced Technology Attachment + // - `nvme`: Non-Volatile Memory Express // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - JobType *string `json:"job_type" validate:"required"` + InterfaceType *string `json:"interface_type" validate:"required"` + + // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. + Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The source this backup was created from (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - Source BackupPolicyJobSourceIntf `json:"source" validate:"required"` - - // The status of the backup policy job. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"` - - // The snapshots operated on by this backup policy job (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - TargetSnapshots []SnapshotReference `json:"target_snapshots" validate:"required"` + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` } -// Constants associated with the BackupPolicyJob.JobType property. -// The type of backup policy job. +// Constants associated with the BareMetalServerDisk.InterfaceType property. +// The disk attachment interface used: +// - `fcp`: Fiber Channel Protocol +// - `sata`: Serial Advanced Technology Attachment +// - `nvme`: Non-Volatile Memory Express // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BackupPolicyJobJobTypeCreationConst = "creation" - BackupPolicyJobJobTypeDeletionConst = "deletion" + BareMetalServerDiskInterfaceTypeFcpConst = "fcp" + BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" + BareMetalServerDiskInterfaceTypeSataConst = "sata" ) -// Constants associated with the BackupPolicyJob.ResourceType property. +// Constants associated with the BareMetalServerDisk.ResourceType property. // The resource type. const ( - BackupPolicyJobResourceTypeBackupPolicyJobConst = "backup_policy_job" -) - -// Constants associated with the BackupPolicyJob.Status property. -// The status of the backup policy job. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BackupPolicyJobStatusFailedConst = "failed" - BackupPolicyJobStatusRunningConst = "running" - BackupPolicyJobStatusSucceededConst = "succeeded" + BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" ) -// UnmarshalBackupPolicyJob unmarshals an instance of BackupPolicyJob from the specified map of raw messages. -func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJob) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter) - if err != nil { - err = core.SDKErrorf(err, "", "auto_delete_after-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) - if err != nil { - err = core.SDKErrorf(err, "", "backup_policy_plan-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) - if err != nil { - err = core.SDKErrorf(err, "", "completed_at-error", common.GetComponentInfo()) - return - } +// UnmarshalBareMetalServerDisk unmarshals an instance of BareMetalServerDisk from the specified map of raw messages. +func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDisk) err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -32484,277 +36485,290 @@ func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { - err = core.SDKErrorf(err, "", "job_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct +type BareMetalServerDiskCollection struct { + // The disks for the bare metal server. + Disks []BareMetalServerDisk `json:"disks" validate:"required"` +} + +// UnmarshalBareMetalServerDiskCollection unmarshals an instance of BareMetalServerDiskCollection from the specified map of raw messages. +func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDiskPatch : BareMetalServerDiskPatch struct +type BareMetalServerDiskPatch struct { + // The name for this bare metal server disk. The name must not be used by another disk on the bare metal server. + Name *string `json:"name,omitempty"` +} + +// UnmarshalBareMetalServerDiskPatch unmarshals an instance of BareMetalServerDiskPatch from the specified map of raw messages. +func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "target_snapshots-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyJobCollection : BackupPolicyJobCollection struct -type BackupPolicyJobCollection struct { - // A link to the first page of resources. - First *BackupPolicyJobCollectionFirst `json:"first" validate:"required"` - - // A page of jobs for the backup policy. - Jobs []BackupPolicyJob `json:"jobs" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` +// AsPatch returns a generic map representation of the BareMetalServerDiskPatch +func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerDiskPatch.Name) { + _patch["name"] = bareMetalServerDiskPatch.Name + } - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BackupPolicyJobCollectionNext `json:"next,omitempty"` + return +} - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +// BareMetalServerFirmware : Firmware information for the bare metal server. +type BareMetalServerFirmware struct { + // The type of update available. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Update *string `json:"update" validate:"required"` } -// UnmarshalBackupPolicyJobCollection unmarshals an instance of BackupPolicyJobCollection from the specified map of raw messages. -func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyJobCollectionFirst) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) +// Constants associated with the BareMetalServerFirmware.Update property. +// The type of update available. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerFirmwareUpdateNoneConst = "none" + BareMetalServerFirmwareUpdateOptionalConst = "optional" + BareMetalServerFirmwareUpdateRequiredConst = "required" +) + +// UnmarshalBareMetalServerFirmware unmarshals an instance of BareMetalServerFirmware from the specified map of raw messages. +func UnmarshalBareMetalServerFirmware(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerFirmware) + err = core.UnmarshalPrimitive(m, "update", &obj.Update) if err != nil { - err = core.SDKErrorf(err, "", "jobs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "update-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitialization : BareMetalServerInitialization struct +type BareMetalServerInitialization struct { + // The image the bare metal server was provisioned from. + Image *ImageReference `json:"image" validate:"required"` + + // The public SSH keys used at initialization. + Keys []KeyReference `json:"keys" validate:"required"` + + // The user accounts that are created at initialization. There can be multiple account types distinguished by the + // `resource_type` property. + UserAccounts []BareMetalServerInitializationUserAccountIntf `json:"user_accounts" validate:"required"` +} + +// UnmarshalBareMetalServerInitialization unmarshals an instance of BareMetalServerInitialization from the specified map of raw messages. +func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitialization) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyJobCollectionNext) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "user_accounts-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil - } - return start, nil -} +// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct +type BareMetalServerInitializationPrototype struct { + // The image to be used when provisioning the bare metal server. + Image ImageIdentityIntf `json:"image" validate:"required"` -// BackupPolicyJobCollectionFirst : A link to the first page of resources. -type BackupPolicyJobCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` + // The public SSH keys to install on the bare metal server. Keys will be made available to the bare metal server as + // cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the + // administrative user. + // + // For Windows images, at least one key must be specified, and one will be selected to encrypt the administrator + // password. Keys are optional for other images, but if no keys are specified, the instance will be inaccessible unless + // the specified image provides another means of access. + Keys []KeyIdentityIntf `json:"keys" validate:"required"` + + // User data to be made available when initializing the bare metal server. + // + // If unspecified, no user data will be made available. + UserData *string `json:"user_data,omitempty"` } -// UnmarshalBackupPolicyJobCollectionFirst unmarshals an instance of BackupPolicyJobCollectionFirst from the specified map of raw messages. -func UnmarshalBackupPolicyJobCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// NewBareMetalServerInitializationPrototype : Instantiate BareMetalServerInitializationPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, keys []KeyIdentityIntf) (_model *BareMetalServerInitializationPrototype, err error) { + _model = &BareMetalServerInitializationPrototype{ + Image: image, + Keys: keys, + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyJobCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BackupPolicyJobCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBackupPolicyJobCollectionNext unmarshals an instance of BackupPolicyJobCollectionNext from the specified map of raw messages. -func UnmarshalBackupPolicyJobCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalBareMetalServerInitializationPrototype unmarshals an instance of BareMetalServerInitializationPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationPrototype) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + err = core.SDKErrorf(err, "", "user_data-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyJobSource : The source this backup was created from (may be -// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). +// BareMetalServerInitializationUserAccount : BareMetalServerInitializationUserAccount struct // Models which "extend" this model: -// - BackupPolicyJobSourceVolumeReference -// - BackupPolicyJobSourceInstanceReference -type BackupPolicyJobSource struct { - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` - - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name,omitempty"` +// - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount +type BareMetalServerInitializationUserAccount struct { + // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password,omitempty"` - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *VolumeRemote `json:"remote,omitempty"` + // The public SSH key used to encrypt the password. + EncryptionKey *KeyReference `json:"encryption_key,omitempty"` // The resource type. ResourceType *string `json:"resource_type,omitempty"` + + // The username for the account created at initialization. + Username *string `json:"username,omitempty"` } -// Constants associated with the BackupPolicyJobSource.ResourceType property. +// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property. // The resource type. const ( - BackupPolicyJobSourceResourceTypeVolumeConst = "volume" + BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" ) -func (*BackupPolicyJobSource) isaBackupPolicyJobSource() bool { +func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool { return true } -type BackupPolicyJobSourceIntf interface { - isaBackupPolicyJobSource() bool +type BareMetalServerInitializationUserAccountIntf interface { + isaBareMetalServerInitializationUserAccount() bool } -// UnmarshalBackupPolicyJobSource unmarshals an instance of BackupPolicyJobSource from the specified map of raw messages. -func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobSource) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalBareMetalServerInitializationUserAccount unmarshals an instance of BareMetalServerInitializationUserAccount from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationUserAccount) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "username", &obj.Username) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct -type BackupPolicyJobStatusReason struct { - // A reason code for the status: - // - `internal_error`: Internal error (contact IBM support) - // - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable - // - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state - // - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached - // - `source_volume_busy`: The source volume has `busy` set (after multiple retries) - // - `source_volume_too_large`: The source volume exceeds the [maximum supported - // size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations) - // - `source_volume_unavailable`: The source volume is not attached to a running instance +// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct +type BareMetalServerLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Code *string `json:"code" validate:"required"` - // An explanation of the status reason. + // An explanation of the reason for this lifecycle state. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // Link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } -// Constants associated with the BackupPolicyJobStatusReason.Code property. -// A reason code for the status: -// - `internal_error`: Internal error (contact IBM support) -// - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable -// - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state -// - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached -// - `source_volume_busy`: The source volume has `busy` set (after multiple retries) -// - `source_volume_too_large`: The source volume exceeds the [maximum supported -// size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations) -// - `source_volume_unavailable`: The source volume is not attached to a running instance +// Constants associated with the BareMetalServerLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `internal_error`: internal error (contact IBM support) +// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM +// support) // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" - BackupPolicyJobStatusReasonCodeSnapshotEncryptionKeyInvalidConst = "snapshot_encryption_key_invalid" - BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" - BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" - BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" - BackupPolicyJobStatusReasonCodeSourceVolumeTooLargeConst = "source_volume_too_large" - BackupPolicyJobStatusReasonCodeSourceVolumeUnavailableConst = "source_volume_unavailable" + BareMetalServerLifecycleReasonCodeInternalErrorConst = "internal_error" + BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) -// UnmarshalBackupPolicyJobStatusReason unmarshals an instance of BackupPolicyJobStatusReason from the specified map of raw messages. -func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobStatusReason) +// UnmarshalBareMetalServerLifecycleReason unmarshals an instance of BareMetalServerLifecycleReason from the specified map of raw messages. +func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerLifecycleReason) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) @@ -32774,163 +36788,146 @@ func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result i return } -// BackupPolicyPatch : BackupPolicyPatch struct -type BackupPolicyPatch struct { - // The included content for backups created using this policy: - // - `boot_volume`: Include the instance's boot volume. - // - `data_volumes`: Include the instance's data volumes. - IncludedContent []string `json:"included_content,omitempty"` - - // The user tags this backup policy will apply to (replacing any existing tags). Resources that have both a matching - // user tag and a matching type will be subject to the backup policy. - MatchUserTags []string `json:"match_user_tags,omitempty"` +// BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment struct +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentByPci +// - BareMetalServerNetworkAttachmentByVlan +type BareMetalServerNetworkAttachment struct { + // The date and time that the bare metal server network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The name for this backup policy. The name must not be used by another backup policy in the region. - Name *string `json:"name,omitempty"` -} + // The URL for this bare metal server network attachment. + Href *string `json:"href" validate:"required"` -// Constants associated with the BackupPolicyPatch.IncludedContent property. -// An item to include. -const ( - BackupPolicyPatchIncludedContentBootVolumeConst = "boot_volume" - BackupPolicyPatchIncludedContentDataVolumesConst = "data_volumes" -) + // The unique identifier for this bare metal server network attachment. + ID *string `json:"id" validate:"required"` -// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPatch) - err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) - if err != nil { - err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) - if err != nil { - err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The network attachment's interface type: + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI attachment + // - Cannot directly use an IEEE 802.1Q tag. + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1Q tag. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + InterfaceType *string `json:"interface_type" validate:"required"` -// AsPatch returns a generic map representation of the BackupPolicyPatch -func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(backupPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} + // The lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` -// BackupPolicyPlan : BackupPolicyPlan struct -type BackupPolicyPlan struct { - // Indicates whether the plan is active. - Active *bool `json:"active" validate:"required"` + // The name for this bare metal server network attachment. The name is unique across all network attachments for the + // bare metal server. + Name *string `json:"name" validate:"required"` - // The user tags to attach to backups (snapshots) created by this plan. - AttachUserTags []string `json:"attach_user_tags" validate:"required"` + // The port speed for this bare metal server network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` - ClonePolicy *BackupPolicyPlanClonePolicy `json:"clone_policy" validate:"required"` + // The primary IP address of the virtual network interface for the bare metal server + // network attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The date and time that the backup policy plan was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The subnet of the virtual network interface for the bare metal server network + // attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. + // The bare metal server network attachment type. // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec" validate:"required"` - - DeletionTrigger *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"` - - // The URL for this backup policy plan. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this backup policy plan. - ID *string `json:"id" validate:"required"` + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Type *string `json:"type" validate:"required"` - // The lifecycle state of this backup policy plan. - LifecycleState *string `json:"lifecycle_state" validate:"required"` + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - // The name for this backup policy plan. The name is unique across all plans in the backup policy. - Name *string `json:"name" validate:"required"` + // The VLAN IDs allowed for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The policies for additional backups in remote regions. - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicy `json:"remote_region_policies" validate:"required"` + // Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for + // network attachments with an `interface_type` of `vlan`. + // + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network attachment will be automatically deleted from this bare metal server and a new network attachment with + // the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for + // this network attachment will be automatically be attached to the new network attachment. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including + // this network attachment's `vlan`. + AllowToFloat *bool `json:"allow_to_float,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. + Vlan *int64 `json:"vlan,omitempty"` } -// Constants associated with the BackupPolicyPlan.LifecycleState property. -// The lifecycle state of this backup policy plan. +// Constants associated with the BareMetalServerNetworkAttachment.InterfaceType property. +// The network attachment's interface type: +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI attachment +// - Cannot directly use an IEEE 802.1Q tag. +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1Q tag. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BackupPolicyPlanLifecycleStateDeletingConst = "deleting" - BackupPolicyPlanLifecycleStateFailedConst = "failed" - BackupPolicyPlanLifecycleStatePendingConst = "pending" - BackupPolicyPlanLifecycleStateStableConst = "stable" - BackupPolicyPlanLifecycleStateSuspendedConst = "suspended" - BackupPolicyPlanLifecycleStateUpdatingConst = "updating" - BackupPolicyPlanLifecycleStateWaitingConst = "waiting" + BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" ) -// Constants associated with the BackupPolicyPlan.ResourceType property. +// Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. +const ( + BareMetalServerNetworkAttachmentLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BareMetalServerNetworkAttachment.ResourceType property. // The resource type. const ( - BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan" + BareMetalServerNetworkAttachmentResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -// UnmarshalBackupPolicyPlan unmarshals an instance of BackupPolicyPlan from the specified map of raw messages. -func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlan) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy) - if err != nil { - err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) - if err != nil { - err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo()) - return - } +// Constants associated with the BareMetalServerNetworkAttachment.Type property. +// The bare metal server network attachment type. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" +) + +func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool { + return true +} + +type BareMetalServerNetworkAttachmentIntf interface { + isaBareMetalServerNetworkAttachment() bool +} + +// UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachment) err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) - if err != nil { - err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -32941,6 +36938,11 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) @@ -32951,134 +36953,78 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy) + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { - err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanClonePolicy : BackupPolicyPlanClonePolicy struct -type BackupPolicyPlanClonePolicy struct { - // The maximum number of recent snapshots (per source) that will keep clones. - MaxSnapshots *int64 `json:"max_snapshots" validate:"required"` - - // The zone this backup policy plan will create snapshot clones in. - Zones []ZoneReference `json:"zones" validate:"required"` -} - -// UnmarshalBackupPolicyPlanClonePolicy unmarshals an instance of BackupPolicyPlanClonePolicy from the specified map of raw messages. -func UnmarshalBackupPolicyPlanClonePolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanClonePolicy) - err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { - err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanClonePolicyPatch : BackupPolicyPlanClonePolicyPatch struct -type BackupPolicyPlanClonePolicyPatch struct { - // The maximum number of recent snapshots (per source) that will keep clones. - MaxSnapshots *int64 `json:"max_snapshots,omitempty"` - - // The zones this backup policy plan will create snapshot clones in. Updating this value does not change the clones for - // snapshots that have already been created by this plan. - Zones []ZoneIdentityIntf `json:"zones,omitempty"` -} - -// UnmarshalBackupPolicyPlanClonePolicyPatch unmarshals an instance of BackupPolicyPlanClonePolicyPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanClonePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanClonePolicyPatch) - err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) if err != nil { - err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanClonePolicyPrototype : BackupPolicyPlanClonePolicyPrototype struct -type BackupPolicyPlanClonePolicyPrototype struct { - // The maximum number of recent snapshots (per source) that will keep clones. - MaxSnapshots *int64 `json:"max_snapshots,omitempty"` - - // The zone this backup policy plan will create snapshot clones in. - Zones []ZoneIdentityIntf `json:"zones" validate:"required"` -} - -// NewBackupPolicyPlanClonePolicyPrototype : Instantiate BackupPolicyPlanClonePolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) (_model *BackupPolicyPlanClonePolicyPrototype, err error) { - _model = &BackupPolicyPlanClonePolicyPrototype{ - Zones: zones, - } - err = core.ValidateStruct(_model, "required parameters") + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) + return } - return -} - -// UnmarshalBackupPolicyPlanClonePolicyPrototype unmarshals an instance of BackupPolicyPlanClonePolicyPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanClonePolicyPrototype) - err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots) + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { - err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { - err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct -type BackupPolicyPlanCollection struct { +// BareMetalServerNetworkAttachmentCollection : BareMetalServerNetworkAttachmentCollection struct +type BareMetalServerNetworkAttachmentCollection struct { // A link to the first page of resources. - First *BackupPolicyPlanCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` + // The network attachments for the bare metal server. + NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" validate:"required"` + // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BackupPolicyPlanCollectionNext `json:"next,omitempty"` - - // A page of plans for the backup policy. - Plans []BackupPolicyPlan `json:"plans" validate:"required"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages. -func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyPlanCollectionFirst) +// UnmarshalBareMetalServerNetworkAttachmentCollection unmarshals an instance of BareMetalServerNetworkAttachmentCollection from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -33088,14 +37034,14 @@ func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result in err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyPlanCollectionNext) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) @@ -33107,331 +37053,402 @@ func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result in return } -// BackupPolicyPlanCollectionFirst : A link to the first page of resources. -type BackupPolicyPlanCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBackupPolicyPlanCollectionFirst unmarshals an instance of BackupPolicyPlanCollectionFirst from the specified map of raw messages. -func UnmarshalBackupPolicyPlanCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BackupPolicyPlanCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBackupPolicyPlanCollectionNext unmarshals an instance of BackupPolicyPlanCollectionNext from the specified map of raw messages. -func UnmarshalBackupPolicyPlanCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + start, err := core.GetQueryParam(resp.Next.Href, "start") if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return + return start, nil } -// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct -type BackupPolicyPlanDeletionTrigger struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after" validate:"required"` +// BareMetalServerNetworkAttachmentPatch : BareMetalServerNetworkAttachmentPatch struct +type BareMetalServerNetworkAttachmentPatch struct { + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment, replacing any existing VLAN IDs. The + // specified values must include IDs for all `vlan` attachments currently using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The maximum number of recent backups to keep. If absent, there is no maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` + // The name for this network attachment. The name must not be used by another network attachment for the bare metal + // server. + Name *string `json:"name,omitempty"` } -// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTrigger) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) +// UnmarshalBareMetalServerNetworkAttachmentPatch unmarshals an instance of BareMetalServerNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPatch) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { - err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct -type BackupPolicyPlanDeletionTriggerPatch struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` - - // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` -} - -// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTriggerPatch) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) - return +// AsPatch returns a generic map representation of the BareMetalServerNetworkAttachmentPatch +func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerNetworkAttachmentPatch.AllowedVlans) { + _patch["allowed_vlans"] = bareMetalServerNetworkAttachmentPatch.AllowedVlans } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) - return + if !core.IsNil(bareMetalServerNetworkAttachmentPatch.Name) { + _patch["name"] = bareMetalServerNetworkAttachmentPatch.Name } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct -type BackupPolicyPlanDeletionTriggerPrototype struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` - - // The maximum number of recent backups to keep. If unspecified, there will be no maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` -} -// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTriggerPrototype) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct -type BackupPolicyPlanPatch struct { - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` +// BareMetalServerNetworkAttachmentPrototype : BareMetalServerNetworkAttachmentPrototype struct +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype +// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype +type BareMetalServerNetworkAttachmentPrototype struct { + // The network attachment's interface type: + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI attachment + // - Cannot directly use an IEEE 802.1Q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1Q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` - // The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user - // tags for backups that have already been created by this plan. - AttachUserTags []string `json:"attach_user_tags,omitempty"` + // The name for this bare metal server network attachment. Names must be unique within the bare metal server the + // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"` + // A virtual network interface for the bare metal server network attachment. This can be + // specified using an existing virtual network interface, or a prototype object for a new + // virtual network interface. + // + // If an existing virtual network interface is specified, it must not be the target of a flow + // log collector. + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. + // Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for + // network attachments with an `interface_type` of `vlan`. // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec,omitempty"` + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network attachment will be automatically deleted from this bare metal server and a new network attachment with + // the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for + // this network attachment will be automatically be attached to the new network attachment. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including + // this network attachment's `vlan`. + AllowToFloat *bool `json:"allow_to_float,omitempty"` - DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. + Vlan *int64 `json:"vlan,omitempty"` +} - // The name for this backup policy plan. The name must not be used by another plan for the backup policy. - Name *string `json:"name,omitempty"` +// Constants associated with the BareMetalServerNetworkAttachmentPrototype.InterfaceType property. +// The network attachment's interface type: +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI attachment +// - Cannot directly use an IEEE 802.1Q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1Q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" +) - // The policies for additional backups in remote regions (replacing any existing policies). - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` +func (*BareMetalServerNetworkAttachmentPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true } -// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanPatch) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) +type BareMetalServerNetworkAttachmentPrototypeIntf interface { + isaBareMetalServerNetworkAttachmentPrototype() bool +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { - err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { - err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { - err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { - err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the BackupPolicyPlanPatch -func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(backupPolicyPlanPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the bare metal server network attachment. This can be specified using an existing +// virtual network interface, or a prototype object for a new virtual network interface. +// +// If an existing virtual network interface is specified, it must not be the target of a flow log collector. +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on + // this interface. If `true`, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` -// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct -type BackupPolicyPlanPrototype struct { - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` - // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. - AttachUserTags []string `json:"attach_user_tags,omitempty"` + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` + // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or + // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // primary IP's subnet. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec" validate:"required"` + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` + // The protocol state filtering mode to use for this virtual network interface. If + // `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target` + // resource type: + // + // - `bare_metal_server_network_attachment`: disabled + // - `instance_network_attachment`: enabled + // - `share_mount_target`: enabled + // + // Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any + // packets that are invalid based on the current connection state and protocol. See [Protocol state filtering + // mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. + ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"` - // The name for this backup policy plan. The name must not be used by another plan for the backup policy. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The resource group to use for this virtual network interface. If unspecified, the + // bare metal server's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The policies for additional backups in remote regions. - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` } -// NewBackupPolicyPlanPrototype : Instantiate BackupPolicyPlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolicyPlanPrototype, err error) { - _model = &BackupPolicyPlanPrototype{ - CronSpec: core.StringPtr(cronSpec), +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface.ProtocolStateFilteringMode property. +// The protocol state filtering mode to use for this virtual network interface. If +// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target` +// resource type: +// +// - `bare_metal_server_network_attachment`: disabled +// - `instance_network_attachment`: enabled +// - `share_mount_target`: enabled +// +// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any +// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering +// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. +const ( + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeAutoConst = "auto" + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeDisabledConst = "disabled" + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeEnabledConst = "enabled" +) + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) + return } - err = core.ValidateStruct(_model, "required parameters") + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo()) + return } - return -} - -// UnmarshalBackupPolicyPlanPrototype unmarshals an instance of BackupPolicyPlanPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanPrototype) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) if err != nil { - err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) + err = core.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) if err != nil { - err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { - err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { - err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { - err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPlanReference : BackupPolicyPlanReference struct -type BackupPolicyPlanReference struct { +// BareMetalServerNetworkAttachmentReference : BareMetalServerNetworkAttachmentReference struct +type BareMetalServerNetworkAttachmentReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. Deleted *Deleted `json:"deleted,omitempty"` - // The URL for this backup policy plan. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this backup policy plan. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" validate:"required"` - // The name for this backup policy plan. The name is unique across all plans in the backup policy. + // The name for this bare metal server network attachment. The name is unique across all network attachments for the + // bare metal server. Name *string `json:"name" validate:"required"` - // If present, this property indicates that the resource associated with this reference - // is remote and therefore may not be directly retrievable. - Remote *BackupPolicyPlanRemote `json:"remote,omitempty"` + // The primary IP address of the virtual network interface for the bare metal server + // network attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` + + // The subnet of the virtual network interface for the bare metal server network + // attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` } -// Constants associated with the BackupPolicyPlanReference.ResourceType property. +// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property. // The resource type. const ( - BackupPolicyPlanReferenceResourceTypeBackupPolicyPlanConst = "backup_policy_plan" + BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -// UnmarshalBackupPolicyPlanReference unmarshals an instance of BackupPolicyPlanReference from the specified map of raw messages. -func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanReference) +// UnmarshalBareMetalServerNetworkAttachmentReference unmarshals an instance of BareMetalServerNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) @@ -33452,9 +37469,9 @@ func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { - err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) @@ -33462,723 +37479,1343 @@ func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPlanRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type BackupPolicyPlanRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` +// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct +// Models which "extend" this model: +// - BareMetalServerNetworkInterfaceByHiperSocket +// - BareMetalServerNetworkInterfaceByPci +// - BareMetalServerNetworkInterfaceByVlan +type BareMetalServerNetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on + // the attached virtual network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the bare metal server network interface was created. + // + // If this bare metal server has network attachments, this network interface was created as a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) when its corresponding + // network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on + // the attached virtual network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the floating IPs are associated + // with the attached virtual network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the identifier is that of the + // corresponding network attachment. + ID *string `json:"id" validate:"required"` + + // The interface type: + // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1Q tag. + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1Q tag. + // - Has its own security groups and does not inherit those of the PCI device through + // which traffic flows. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the interface type is that of the + // corresponding network attachment. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be empty. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the + // attached virtual network interface. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding + // network attachment. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the port speed is that of its + // corresponding network attachment. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the security groups are associated + // with the attached virtual network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a read-only representation of its + // corresponding network attachment and its attached virtual network interface, and the status is [computed from + // them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The bare metal server network interface type. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the type is that of its + // corresponding network attachment. + Type *string `json:"type" validate:"required"` + + // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the VLAN IDs match the + // `allow_vlans` of the corresponding network attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for + // network interfaces with an `interface_type` of `vlan`. + // + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network interface will be automatically deleted from this bare metal server and a new network interface with the + // same `id`, `name` and `vlan` will be created on the other bare metal server. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including + // this network interface's `vlan`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the value of this property matches + // that of the `allow_to_float` property of the corresponding network attachment. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of + // the corresponding network attachment. + Vlan *int64 `json:"vlan,omitempty"` } -// UnmarshalBackupPolicyPlanRemote unmarshals an instance of BackupPolicyPlanRemote from the specified map of raw messages. -func UnmarshalBackupPolicyPlanRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanRemote) - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) +// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. +// The interface type: +// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1Q tag. +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1Q tag. +// - Has its own security groups and does not inherit those of the PCI device through +// which traffic flows. +// +// If this bare metal server has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its +// corresponding network attachment and its attached virtual network interface, and the interface type is that of the +// corresponding network attachment. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" +) + +// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterface.Status property. +// The status of the bare metal server network interface. +// +// If this bare metal server has network attachments, this network interface is a read-only representation of its +// corresponding network attachment and its attached virtual network interface, and the status is [computed from +// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). +const ( + BareMetalServerNetworkInterfaceStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterface.Type property. +// The bare metal server network interface type. +// +// If this bare metal server has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its +// corresponding network attachment and its attached virtual network interface, and the type is that of its +// corresponding network attachment. +const ( + BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" +) + +func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { + return true +} + +type BareMetalServerNetworkInterfaceIntf interface { + isaBareMetalServerNetworkInterface() bool +} + +// UnmarshalBareMetalServerNetworkInterface unmarshals an instance of BareMetalServerNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "interface_type", &discValue) if err != nil { - err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if discValue == "" { + err = core.SDKErrorf(err, "required discriminator property 'interface_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) + return + } + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByHiperSocket-error", common.GetComponentInfo()) + } + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByPci-error", common.GetComponentInfo()) + } + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByVlan-error", common.GetComponentInfo()) + } + } else { + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) + } return } -// BackupPolicyPlanRemoteRegionPolicy : BackupPolicyPlanRemoteRegionPolicy struct -type BackupPolicyPlanRemoteRegionPolicy struct { - // The region this backup policy plan will create backups in. - DeleteOverCount *int64 `json:"delete_over_count" validate:"required"` +// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct +type BareMetalServerNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` - // The root key used to rewrap the data encryption key for the backup (snapshot). - EncryptionKey *EncryptionKeyReference `json:"encryption_key" validate:"required"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // The region this backup policy plan will create backups in. - Region *RegionReference `json:"region" validate:"required"` + // The network interfaces for the bare metal server. + NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBackupPolicyPlanRemoteRegionPolicy unmarshals an instance of BackupPolicyPlanRemoteRegionPolicy from the specified map of raw messages. -func UnmarshalBackupPolicyPlanRemoteRegionPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanRemoteRegionPolicy) - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) +// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) if err != nil { - err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPlanRemoteRegionPolicyPrototype : BackupPolicyPlanRemoteRegionPolicyPrototype struct -type BackupPolicyPlanRemoteRegionPolicyPrototype struct { - // The region this backup policy plan will create backups in. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} - // The root key to use to rewrap the data encryption key for the backup (snapshot). +// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct +type BareMetalServerNetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. // - // If unspecified, the source's `encryption_key` will be used. - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on + // the attached virtual network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The region this backup policy plan will create backups in. - Region RegionIdentityIntf `json:"region" validate:"required"` + // The VLAN IDs to allow for `vlan` interfaces using this PCI interface, replacing any existing VLAN IDs. The specified + // values must include IDs for all `vlan` interfaces currently using this PCI interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on + // the attached virtual network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. + Name *string `json:"name,omitempty"` } -// NewBackupPolicyPlanRemoteRegionPolicyPrototype : Instantiate BackupPolicyPlanRemoteRegionPolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPlanRemoteRegionPolicyPrototype(region RegionIdentityIntf) (_model *BackupPolicyPlanRemoteRegionPolicyPrototype, err error) { - _model = &BackupPolicyPlanRemoteRegionPolicyPrototype{ - Region: region, - } - err = core.ValidateStruct(_model, "required parameters") +// UnmarshalBareMetalServerNetworkInterfacePatch unmarshals an instance of BareMetalServerNetworkInterfacePatch from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) + return } - return -} - -// UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype unmarshals an instance of BackupPolicyPlanRemoteRegionPolicyPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanRemoteRegionPolicyPrototype) - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { - err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { - err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPrototype : BackupPolicyPrototype struct +// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch +func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowIPSpoofing) { + _patch["allow_ip_spoofing"] = bareMetalServerNetworkInterfacePatch.AllowIPSpoofing + } + if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowedVlans) { + _patch["allowed_vlans"] = bareMetalServerNetworkInterfacePatch.AllowedVlans + } + if !core.IsNil(bareMetalServerNetworkInterfacePatch.EnableInfrastructureNat) { + _patch["enable_infrastructure_nat"] = bareMetalServerNetworkInterfacePatch.EnableInfrastructureNat + } + if !core.IsNil(bareMetalServerNetworkInterfacePatch.Name) { + _patch["name"] = bareMetalServerNetworkInterfacePatch.Name + } + + return +} + +// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct // Models which "extend" this model: -// - BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype -// - BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype -type BackupPolicyPrototype struct { - // The resource type this backup policy will apply to. Resources that have both a matching type and a matching user tag - // will be subject to the backup policy. - MatchResourceType *string `json:"match_resource_type" validate:"required"` +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype +type BareMetalServerNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on + // the attached virtual network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The user tags this backup policy will apply to. Resources that have both a matching user tag and a matching type - // will be subject to the backup policy. - MatchUserTags []string `json:"match_user_tags" validate:"required"` + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on + // the attached virtual network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The name for this backup policy. The name must not be used by another backup policy in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. + // The interface type: + // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1Q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1Q tag. + // - Has its own security groups and does not inherit those of the PCI device through + // which traffic flows. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The prototype objects for backup plans to be created for this backup policy. - Plans []BackupPolicyPlanPrototype `json:"plans,omitempty"` + // The primary IP address to bind to the bare metal server network interface. This can be + // specified using an existing reserved IP, or a prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must + // be available on the bare metal server network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security + // group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // The scope to use for this backup policy. + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for + // network interfaces with an `interface_type` of `vlan`. // - // If unspecified, the policy will be scoped to the account. - Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"` + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network interface will be automatically deleted from this bare metal server and a new network interface with the + // same `id`, `name` and `vlan` will be created on the other bare metal server. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including + // this network interface's `vlan`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the value of this property matches + // that of the `allow_to_float` property of the corresponding network attachment. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - // The included content for backups created using this policy: - // - `boot_volume`: Include the instance's boot volume. - // - `data_volumes`: Include the instance's data volumes. - IncludedContent []string `json:"included_content,omitempty"` + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of + // the corresponding network attachment. + Vlan *int64 `json:"vlan,omitempty"` } -// Constants associated with the BackupPolicyPrototype.MatchResourceType property. -// The resource type this backup policy will apply to. Resources that have both a matching type and a matching user tag -// will be subject to the backup policy. -const ( - BackupPolicyPrototypeMatchResourceTypeInstanceConst = "instance" - BackupPolicyPrototypeMatchResourceTypeVolumeConst = "volume" -) - -// Constants associated with the BackupPolicyPrototype.IncludedContent property. -// An item to include. +// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. +// The interface type: +// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1Q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1Q tag. +// - Has its own security groups and does not inherit those of the PCI device through +// which traffic flows. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BackupPolicyPrototypeIncludedContentBootVolumeConst = "boot_volume" - BackupPolicyPrototypeIncludedContentDataVolumesConst = "data_volumes" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" ) -func (*BackupPolicyPrototype) isaBackupPolicyPrototype() bool { +func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { return true } -type BackupPolicyPrototypeIntf interface { - isaBackupPolicyPrototype() bool +type BareMetalServerNetworkInterfacePrototypeIntf interface { + isaBareMetalServerNetworkInterfacePrototype() bool } -// UnmarshalBackupPolicyPrototype unmarshals an instance of BackupPolicyPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPrototype) - err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) +// UnmarshalBareMetalServerNetworkInterfacePrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "interface_type", &discValue) if err != nil { - err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) - if err != nil { - err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) + if discValue == "" { + err = core.SDKErrorf(err, "required discriminator property 'interface_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype-error", common.GetComponentInfo()) + } + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype-error", common.GetComponentInfo()) + } + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype-error", common.GetComponentInfo()) + } + } else { + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype) + return +} + +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified + // value must match one of the bandwidth values in the bare metal server's profile. + Bandwidth *int64 `json:"bandwidth,omitempty"` + + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server + // will fail to boot. + // + // For `enable_secure_boot` to be changed, the bare metal server `status` must be + // `stopped`. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. Changing + // the name will not affect the system hostname. + Name *string `json:"name,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` +} + +// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages. +func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPatch) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { - err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "scope-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) if err != nil { - err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyScope : The scope for this backup policy. +// AsPatch returns a generic map representation of the BareMetalServerPatch +func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerPatch.Bandwidth) { + _patch["bandwidth"] = bareMetalServerPatch.Bandwidth + } + if !core.IsNil(bareMetalServerPatch.EnableSecureBoot) { + _patch["enable_secure_boot"] = bareMetalServerPatch.EnableSecureBoot + } + if !core.IsNil(bareMetalServerPatch.Name) { + _patch["name"] = bareMetalServerPatch.Name + } + if !core.IsNil(bareMetalServerPatch.TrustedPlatformModule) { + _patch["trusted_platform_module"] = bareMetalServerPatch.TrustedPlatformModule.asPatch() + } + + return +} + +// BareMetalServerPrimaryNetworkAttachmentPrototype : BareMetalServerPrimaryNetworkAttachmentPrototype struct // Models which "extend" this model: -// - BackupPolicyScopeEnterpriseReference -// - BackupPolicyScopeAccountReference -type BackupPolicyScope struct { - // The CRN for this enterprise. - CRN *string `json:"crn,omitempty"` +// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype +type BareMetalServerPrimaryNetworkAttachmentPrototype struct { + // The network attachment's interface type: + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI attachment + // - Cannot directly use an IEEE 802.1Q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type,omitempty"` - // The unique identifier for this enterprise. - ID *string `json:"id,omitempty"` + // The name for this bare metal server network attachment. Names must be unique within the bare metal server the + // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` + // A virtual network interface for the bare metal server network attachment. This can be + // specified using an existing virtual network interface, or a prototype object for a new + // virtual network interface. + // + // If an existing virtual network interface is specified, it must not be the target of a flow + // log collector. + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` } -// Constants associated with the BackupPolicyScope.ResourceType property. -// The resource type. +// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototype.InterfaceType property. +// The network attachment's interface type: +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI attachment +// - Cannot directly use an IEEE 802.1Q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BackupPolicyScopeResourceTypeEnterpriseConst = "enterprise" + BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" ) -func (*BackupPolicyScope) isaBackupPolicyScope() bool { +func (*BareMetalServerPrimaryNetworkAttachmentPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { return true } -type BackupPolicyScopeIntf interface { - isaBackupPolicyScope() bool +type BareMetalServerPrimaryNetworkAttachmentPrototypeIntf interface { + isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool } -// UnmarshalBackupPolicyScope unmarshals an instance of BackupPolicyScope from the specified map of raw messages. -func UnmarshalBackupPolicyScope(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScope) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyScopePrototype : The scope to use for this backup policy. -// -// If unspecified, the policy will be scoped to the account. -// Models which "extend" this model: -// - BackupPolicyScopePrototypeEnterpriseIdentity -type BackupPolicyScopePrototype struct { - // The CRN for this enterprise. - CRN *string `json:"crn,omitempty"` -} - -func (*BackupPolicyScopePrototype) isaBackupPolicyScopePrototype() bool { - return true -} - -type BackupPolicyScopePrototypeIntf interface { - isaBackupPolicyScopePrototype() bool -} - -// UnmarshalBackupPolicyScopePrototype unmarshals an instance of BackupPolicyScopePrototype from the specified map of raw messages. -func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopePrototype) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServer : BareMetalServer struct -type BareMetalServer struct { - // The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal - // server network interfaces. - Bandwidth *int64 `json:"bandwidth" validate:"required"` +// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct +type BareMetalServerPrimaryNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on + // the attached virtual network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The resource from which this bare metal server is booted. + // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. // - // The resources supported by this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and the VLAN IDs match the + // `allow_vlans` of the corresponding network attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The bare metal server CPU configuration. - Cpu *BareMetalServerCpu `json:"cpu" validate:"required"` + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its + // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on + // the attached virtual network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The date and time that the bare metal server was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The interface type: + // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity + // within a `s390x` based system. + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1Q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type,omitempty"` - // The CRN for this bare metal server. - CRN *string `json:"crn" validate:"required"` + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The disks for this bare metal server, including any disks that are associated with the - // `boot_target`. - Disks []BareMetalServerDisk `json:"disks" validate:"required"` + // The primary IP address to bind to the bare metal server network interface. This can be + // specified using an existing reserved IP, or a prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must + // be available on the bare metal server network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to - // boot. - EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"` + // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security + // group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // Firmware information for the bare metal server. - Firmware *BareMetalServerFirmware `json:"firmware" validate:"required"` + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +} - // The URL for this bare metal server. - Href *string `json:"href" validate:"required"` +// Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. +// The interface type: +// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1Q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" +) - // The unique identifier for this bare metal server. - ID *string `json:"id" validate:"required"` +// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) { + _model = &BareMetalServerPrimaryNetworkInterfacePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` +// UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype unmarshals an instance of BareMetalServerPrimaryNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The lifecycle state of the bare metal server. - LifecycleState *string `json:"lifecycle_state" validate:"required"` +// BareMetalServerProfile : BareMetalServerProfile struct +type BareMetalServerProfile struct { + Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"` + + // The console type configuration for a bare metal server with this profile. + ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"` - // The amount of memory, truncated to whole gibibytes. - Memory *int64 `json:"memory" validate:"required"` + CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"` - // The name for this bare metal server. The name is unique across all bare metal servers in the region. - Name *string `json:"name" validate:"required"` + CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"` - // The network attachments for this bare metal server, including the primary network attachment. - NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"` + CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` - // The network interfaces for this bare metal server, including the primary network interface. - // - // If this bare metal server has network attachments, each network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface. - NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` + // The disks for a bare metal server with this profile. + Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` - // The primary network attachment for this bare metal server. - PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` + // The product family this bare metal server profile belongs to. + Family *string `json:"family" validate:"required"` - // The primary network interface for this bare metal server. - // - // If this bare metal server has network attachments, this primary network interface is - // a [read-only - // representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) - // of the primary network attachment and its attached virtual network interface. - PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) - // for this bare metal server. - Profile *BareMetalServerProfileReference `json:"profile" validate:"required"` + Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` - // The resource group for this bare metal server. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + NetworkAttachmentCount BareMetalServerProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` - // The status of this bare metal server: - // - `deleting`: server is undergoing deletion - // - `failed`: server is failed and not usable (see `status_reasons`) - // - `maintenance`: server is undergoing maintenance (not usable) - // - `pending`: server is being provisioned and not yet usable - // - `reinitializing`: server is reinitializing and not yet usable - // - `restarting`: server is restarting and not yet usable - // - `running`: server is powered on - // - `starting`: server is starting and not yet usable - // - `stopped`: server is powered off - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Status *string `json:"status" validate:"required"` + NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` - // The reasons for the current status (if any). - StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"` + OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` - TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The VPC this bare metal server resides in. - VPC *VPCReference `json:"vpc" validate:"required"` + // The supported trusted platform module modes for this bare metal server profile. + SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` - // The zone this bare metal server resides in. - Zone *ZoneReference `json:"zone" validate:"required"` + // Indicates whether this profile supports virtual network interfaces. + VirtualNetworkInterfacesSupported *BareMetalServerProfileVirtualNetworkInterfacesSupported `json:"virtual_network_interfaces_supported" validate:"required"` } -// Constants associated with the BareMetalServer.LifecycleState property. -// The lifecycle state of the bare metal server. -const ( - BareMetalServerLifecycleStateDeletingConst = "deleting" - BareMetalServerLifecycleStateFailedConst = "failed" - BareMetalServerLifecycleStatePendingConst = "pending" - BareMetalServerLifecycleStateStableConst = "stable" - BareMetalServerLifecycleStateSuspendedConst = "suspended" - BareMetalServerLifecycleStateUpdatingConst = "updating" - BareMetalServerLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BareMetalServer.ResourceType property. +// Constants associated with the BareMetalServerProfile.ResourceType property. // The resource type. const ( - BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" -) - -// Constants associated with the BareMetalServer.Status property. -// The status of this bare metal server: -// - `deleting`: server is undergoing deletion -// - `failed`: server is failed and not usable (see `status_reasons`) -// - `maintenance`: server is undergoing maintenance (not usable) -// - `pending`: server is being provisioned and not yet usable -// - `reinitializing`: server is reinitializing and not yet usable -// - `restarting`: server is restarting and not yet usable -// - `running`: server is powered on -// - `starting`: server is starting and not yet usable -// - `stopped`: server is powered off -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerStatusDeletingConst = "deleting" - BareMetalServerStatusFailedConst = "failed" - BareMetalServerStatusMaintenanceConst = "maintenance" - BareMetalServerStatusPendingConst = "pending" - BareMetalServerStatusReinitializingConst = "reinitializing" - BareMetalServerStatusRestartingConst = "restarting" - BareMetalServerStatusRunningConst = "running" - BareMetalServerStatusStartingConst = "starting" - BareMetalServerStatusStoppedConst = "stopped" + BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" ) -// UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages. -func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServer) - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) +// UnmarshalBareMetalServerProfile unmarshals an instance of BareMetalServerProfile from the specified map of raw messages. +func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfile) + err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalBareMetalServerProfileBandwidth) if err != nil { err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) + err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) if err != nil { - err = core.SDKErrorf(err, "", "boot_target-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "console_types-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) + err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) if err != nil { - err = core.SDKErrorf(err, "", "cpu-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cpu_architecture-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) if err != nil { - err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cpu_core_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cpu_socket_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) if err != nil { err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "firmware", &obj.Firmware, UnmarshalBareMetalServerFirmware) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "firmware-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason) + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalBareMetalServerProfileNetworkAttachmentCount) if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "network_attachment_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "network_interface_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) if err != nil { - err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) + err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "supported_trusted_platform_module_modes-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) + err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported) if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "virtual_network_interfaces_supported-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerNetworkAttachmentReference) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct +// Models which "extend" this model: +// - BareMetalServerProfileBandwidthFixed +// - BareMetalServerProfileBandwidthRange +// - BareMetalServerProfileBandwidthEnum +// - BareMetalServerProfileBandwidthDependent +type BareMetalServerProfileBandwidth struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the BareMetalServerProfileBandwidth.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { + return true +} + +type BareMetalServerProfileBandwidthIntf interface { + isaBareMetalServerProfileBandwidth() bool +} + +// UnmarshalBareMetalServerProfileBandwidth unmarshals an instance of BareMetalServerProfileBandwidth from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct +type BareMetalServerProfileCpuArchitecture struct { + // The default CPU architecture for a bare metal server with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The CPU architecture for a bare metal server with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalBareMetalServerProfileCpuArchitecture unmarshals an instance of BareMetalServerProfileCpuArchitecture from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerBootTarget : The resource from which this bare metal server is booted. -// -// The resources supported by this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct // Models which "extend" this model: -// - BareMetalServerBootTargetBareMetalServerDiskReference -type BareMetalServerBootTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` +// - BareMetalServerProfileCpuCoreCountFixed +// - BareMetalServerProfileCpuCoreCountRange +// - BareMetalServerProfileCpuCoreCountEnum +// - BareMetalServerProfileCpuCoreCountDependent +type BareMetalServerProfileCpuCoreCount struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` - // The URL for this bare metal server disk. - Href *string `json:"href,omitempty"` + // The value for this profile field. + Value *int64 `json:"value,omitempty"` - // The unique identifier for this bare metal server disk. - ID *string `json:"id,omitempty"` + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` - // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. - Name *string `json:"name,omitempty"` + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerBootTarget.ResourceType property. -// The resource type. +// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. +// The type for this profile field. const ( - BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" + BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" ) -func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { +func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { return true } -type BareMetalServerBootTargetIntf interface { - isaBareMetalServerBootTarget() bool +type BareMetalServerProfileCpuCoreCountIntf interface { + isaBareMetalServerProfileCpuCoreCount() bool } -// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages. -func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerBootTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) +// UnmarshalBareMetalServerProfileCpuCoreCount unmarshals an instance of BareMetalServerProfileCpuCoreCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerCpu : The bare metal server CPU configuration. -type BareMetalServerCpu struct { - // The CPU architecture. - Architecture *string `json:"architecture" validate:"required"` +// BareMetalServerProfileCpuSocketCount : BareMetalServerProfileCpuSocketCount struct +// Models which "extend" this model: +// - BareMetalServerProfileCpuSocketCountFixed +// - BareMetalServerProfileCpuSocketCountRange +// - BareMetalServerProfileCpuSocketCountEnum +// - BareMetalServerProfileCpuSocketCountDependent +type BareMetalServerProfileCpuSocketCount struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` - // The total number of cores. - CoreCount *int64 `json:"core_count" validate:"required"` + // The value for this profile field. + Value *int64 `json:"value,omitempty"` - // The total number of CPU sockets. - SocketCount *int64 `json:"socket_count" validate:"required"` + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` - // The total number of hardware threads per core. - ThreadsPerCore *int64 `json:"threads_per_core" validate:"required"` + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages. -func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCpu) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) +// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +type BareMetalServerProfileCpuSocketCountIntf interface { + isaBareMetalServerProfileCpuSocketCount() bool +} + +// UnmarshalBareMetalServerProfileCpuSocketCount unmarshals an instance of BareMetalServerProfileCpuSocketCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "core_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { - err = core.SDKErrorf(err, "", "threads_per_core-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerCollection : BareMetalServerCollection struct -type BareMetalServerCollection struct { - // A page of bare metal servers. - BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` - +// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct +type BareMetalServerProfileCollection struct { // A link to the first page of resources. - First *BareMetalServerCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BareMetalServerCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` + + // A page of bare metal server profiles. + Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBareMetalServerCollection unmarshals an instance of BareMetalServerCollection from the specified map of raw messages. -func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollection) - err = core.UnmarshalModel(m, "bare_metal_servers", &obj.BareMetalServers, UnmarshalBareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "bare_metal_servers-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) +// UnmarshalBareMetalServerProfileCollection unmarshals an instance of BareMetalServerProfileCollection from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -34188,11 +38825,16 @@ func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + if err != nil { + err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) @@ -34203,7 +38845,7 @@ func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result int } // Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { +func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -34217,413 +38859,601 @@ func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { return start, nil } -// BareMetalServerCollectionFirst : A link to the first page of resources. -type BareMetalServerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` +// BareMetalServerProfileConsoleTypes : The console type configuration for a bare metal server with this profile. +type BareMetalServerProfileConsoleTypes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The console types for a bare metal server with this profile. + Values []string `json:"values" validate:"required"` } -// UnmarshalBareMetalServerCollectionFirst unmarshals an instance of BareMetalServerCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. +// A console type. +const ( + BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" + BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" +) + +// UnmarshalBareMetalServerProfileConsoleTypes unmarshals an instance of BareMetalServerProfileConsoleTypes from the specified map of raw messages. +func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileConsoleTypes) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` +// BareMetalServerProfileDisk : Disks provided by this profile. +type BareMetalServerProfileDisk struct { + Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` + + Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` + + SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` } -// UnmarshalBareMetalServerCollectionNext unmarshals an instance of BareMetalServerCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalBareMetalServerProfileDisk unmarshals an instance of BareMetalServerProfileDisk from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDisk) + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + if err != nil { + err = core.SDKErrorf(err, "", "supported_interface_types-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerConsoleAccessToken : The bare metal server console access token information. -type BareMetalServerConsoleAccessToken struct { - // A URL safe single-use token used to access the console WebSocket. - AccessToken *string `json:"access_token" validate:"required"` +// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct +// Models which "extend" this model: +// - BareMetalServerProfileDiskQuantityFixed +// - BareMetalServerProfileDiskQuantityRange +// - BareMetalServerProfileDiskQuantityEnum +// - BareMetalServerProfileDiskQuantityDependent +type BareMetalServerProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` - // The bare metal server console type for which this token may be used. - ConsoleType *string `json:"console_type" validate:"required"` + // The value for this profile field. + Value *int64 `json:"value,omitempty"` - // The date and time that the access token was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` - // The date and time that the access token will expire. - ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` - // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has - // no effect on VNC consoles. - Force *bool `json:"force" validate:"required"` + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` - // The URL to access this bare metal server console. - Href *string `json:"href" validate:"required"` + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. -// The bare metal server console type for which this token may be used. +// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. +// The type for this profile field. const ( - BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" - BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" + BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" ) -// UnmarshalBareMetalServerConsoleAccessToken unmarshals an instance of BareMetalServerConsoleAccessToken from the specified map of raw messages. -func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerConsoleAccessToken) - err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) +func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +type BareMetalServerProfileDiskQuantityIntf interface { + isaBareMetalServerProfileDiskQuantity() bool +} + +// UnmarshalBareMetalServerProfileDiskQuantity unmarshals an instance of BareMetalServerProfileDiskQuantity from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "console_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { - err = core.SDKErrorf(err, "", "expires_at-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "force", &obj.Force) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { - err = core.SDKErrorf(err, "", "force-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerDisk : BareMetalServerDisk struct -type BareMetalServerDisk struct { - // The date and time that the disk was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` +// BareMetalServerProfileDiskSize : BareMetalServerProfileDiskSize struct +// Models which "extend" this model: +// - BareMetalServerProfileDiskSizeFixed +// - BareMetalServerProfileDiskSizeRange +// - BareMetalServerProfileDiskSizeEnum +// - BareMetalServerProfileDiskSizeDependent +type BareMetalServerProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` - // The URL for this bare metal server disk. - Href *string `json:"href" validate:"required"` + // The value for this profile field. + Value *int64 `json:"value,omitempty"` - // The unique identifier for this bare metal server disk. - ID *string `json:"id" validate:"required"` + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` - // The disk attachment interface used: - // - `fcp`: Fiber Channel Protocol - // - `sata`: Serial Advanced Technology Attachment - // - `nvme`: Non-Volatile Memory Express - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - InterfaceType *string `json:"interface_type" validate:"required"` + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` - // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. - Name *string `json:"name" validate:"required"` + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` - // The size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerDisk.InterfaceType property. -// The disk attachment interface used: -// - `fcp`: Fiber Channel Protocol -// - `sata`: Serial Advanced Technology Attachment -// - `nvme`: Non-Volatile Memory Express -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +// Constants associated with the BareMetalServerProfileDiskSize.Type property. +// The type for this profile field. const ( - BareMetalServerDiskInterfaceTypeFcpConst = "fcp" - BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" - BareMetalServerDiskInterfaceTypeSataConst = "sata" + BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" ) -// Constants associated with the BareMetalServerDisk.ResourceType property. -// The resource type. -const ( - BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) +func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { + return true +} -// UnmarshalBareMetalServerDisk unmarshals an instance of BareMetalServerDisk from the specified map of raw messages. -func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDisk) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) +type BareMetalServerProfileDiskSizeIntf interface { + isaBareMetalServerProfileDiskSize() bool +} + +// UnmarshalBareMetalServerProfileDiskSize unmarshals an instance of BareMetalServerProfileDiskSize from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct -type BareMetalServerDiskCollection struct { - // The disks for the bare metal server. - Disks []BareMetalServerDisk `json:"disks" validate:"required"` +// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct +type BareMetalServerProfileDiskSupportedInterfaces struct { + // The default value for this profile field. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported disk interfaces used for attaching the disk. + Values []string `json:"values" validate:"required"` } -// UnmarshalBareMetalServerDiskCollection unmarshals an instance of BareMetalServerDiskCollection from the specified map of raw messages. -func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskCollection) - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. +// The default value for this profile field. +const ( + BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" +) + +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. +// The disk attachment interface used: +// - `fcp`: Fiber Channel Protocol +// - `sata`: Serial Advanced Technology Attachment +// - `nvme`: Non-Volatile Memory Express +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" +) + +// UnmarshalBareMetalServerProfileDiskSupportedInterfaces unmarshals an instance of BareMetalServerProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerDiskPatch : BareMetalServerDiskPatch struct -type BareMetalServerDiskPatch struct { - // The name for this bare metal server disk. The name must not be used by another disk on the bare metal server. +// BareMetalServerProfileIdentity : Identifies a bare metal server profile by a unique property. +// Models which "extend" this model: +// - BareMetalServerProfileIdentityByName +// - BareMetalServerProfileIdentityByHref +type BareMetalServerProfileIdentity struct { + // The name for this bare metal server profile. Name *string `json:"name,omitempty"` + + // The URL for this bare metal server profile. + Href *string `json:"href,omitempty"` } -// UnmarshalBareMetalServerDiskPatch unmarshals an instance of BareMetalServerDiskPatch from the specified map of raw messages. -func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskPatch) +func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { + return true +} + +type BareMetalServerProfileIdentityIntf interface { + isaBareMetalServerProfileIdentity() bool +} + +// UnmarshalBareMetalServerProfileIdentity unmarshals an instance of BareMetalServerProfileIdentity from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentity) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the BareMetalServerDiskPatch -func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerDiskPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) +// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct +// Models which "extend" this model: +// - BareMetalServerProfileMemoryFixed +// - BareMetalServerProfileMemoryRange +// - BareMetalServerProfileMemoryEnum +// - BareMetalServerProfileMemoryDependent +type BareMetalServerProfileMemory struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the BareMetalServerProfileMemory.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { + return true +} + +type BareMetalServerProfileMemoryIntf interface { + isaBareMetalServerProfileMemory() bool +} + +// UnmarshalBareMetalServerProfileMemory unmarshals an instance of BareMetalServerProfileMemory from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerFirmware : Firmware information for the bare metal server. -type BareMetalServerFirmware struct { - // The type of update available. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Update *string `json:"update" validate:"required"` +// BareMetalServerProfileNetworkAttachmentCount : BareMetalServerProfileNetworkAttachmentCount struct +// Models which "extend" this model: +// - BareMetalServerProfileNetworkAttachmentCountRange +// - BareMetalServerProfileNetworkAttachmentCountDependent +type BareMetalServerProfileNetworkAttachmentCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` } -// Constants associated with the BareMetalServerFirmware.Update property. -// The type of update available. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. +// The type for this profile field. const ( - BareMetalServerFirmwareUpdateNoneConst = "none" - BareMetalServerFirmwareUpdateOptionalConst = "optional" - BareMetalServerFirmwareUpdateRequiredConst = "required" + BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" ) -// UnmarshalBareMetalServerFirmware unmarshals an instance of BareMetalServerFirmware from the specified map of raw messages. -func UnmarshalBareMetalServerFirmware(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerFirmware) - err = core.UnmarshalPrimitive(m, "update", &obj.Update) +func (*BareMetalServerProfileNetworkAttachmentCount) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +type BareMetalServerProfileNetworkAttachmentCountIntf interface { + isaBareMetalServerProfileNetworkAttachmentCount() bool +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCount unmarshals an instance of BareMetalServerProfileNetworkAttachmentCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { - err = core.SDKErrorf(err, "", "update-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerInitialization : BareMetalServerInitialization struct -type BareMetalServerInitialization struct { - // The image the bare metal server was provisioned from. - Image *ImageReference `json:"image" validate:"required"` +// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct +// Models which "extend" this model: +// - BareMetalServerProfileNetworkInterfaceCountRange +// - BareMetalServerProfileNetworkInterfaceCountDependent +type BareMetalServerProfileNetworkInterfaceCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` - // The public SSH keys used at initialization. - Keys []KeyReference `json:"keys" validate:"required"` + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` - // The user accounts that are created at initialization. There can be multiple account types distinguished by the - // `resource_type` property. - UserAccounts []BareMetalServerInitializationUserAccountIntf `json:"user_accounts" validate:"required"` + // The type for this profile field. + Type *string `json:"type,omitempty"` } -// UnmarshalBareMetalServerInitialization unmarshals an instance of BareMetalServerInitialization from the specified map of raw messages. -func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitialization) - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) +// Constants associated with the BareMetalServerProfileNetworkInterfaceCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { + return true +} + +type BareMetalServerProfileNetworkInterfaceCountIntf interface { + isaBareMetalServerProfileNetworkInterfaceCount() bool +} + +// UnmarshalBareMetalServerProfileNetworkInterfaceCount unmarshals an instance of BareMetalServerProfileNetworkInterfaceCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "user_accounts-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct -type BareMetalServerInitializationPrototype struct { - // The image to be used when provisioning the bare metal server. - Image ImageIdentityIntf `json:"image" validate:"required"` +// BareMetalServerProfileOsArchitecture : BareMetalServerProfileOsArchitecture struct +type BareMetalServerProfileOsArchitecture struct { + // The default OS architecture for a bare metal server with this profile. + Default *string `json:"default" validate:"required"` - // The public SSH keys to install on the bare metal server. Keys will be made available to the bare metal server as - // cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the - // administrative user. - // - // For Windows images, at least one key must be specified, and one will be selected to encrypt the administrator - // password. Keys are optional for other images, but if no keys are specified, the instance will be inaccessible unless - // the specified image provides another means of access. - Keys []KeyIdentityIntf `json:"keys" validate:"required"` + // The type for this profile field. + Type *string `json:"type" validate:"required"` - // User data to be made available when initializing the bare metal server. - // - // If unspecified, no user data will be made available. - UserData *string `json:"user_data,omitempty"` + // The supported OS architecture(s) for a bare metal server with this profile. + Values []string `json:"values" validate:"required"` } -// NewBareMetalServerInitializationPrototype : Instantiate BareMetalServerInitializationPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, keys []KeyIdentityIntf) (_model *BareMetalServerInitializationPrototype, err error) { - _model = &BareMetalServerInitializationPrototype{ - Image: image, - Keys: keys, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} +// Constants associated with the BareMetalServerProfileOsArchitecture.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileOsArchitectureTypeEnumConst = "enum" +) -// UnmarshalBareMetalServerInitializationPrototype unmarshals an instance of BareMetalServerInitializationPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationPrototype) - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) +// UnmarshalBareMetalServerProfileOsArchitecture unmarshals an instance of BareMetalServerProfileOsArchitecture from the specified map of raw messages. +func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileOsArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { - err = core.SDKErrorf(err, "", "user_data-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerInitializationUserAccount : BareMetalServerInitializationUserAccount struct -// Models which "extend" this model: -// - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount -type BareMetalServerInitializationUserAccount struct { - // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. - EncryptedPassword *[]byte `json:"encrypted_password,omitempty"` +// BareMetalServerProfileReference : BareMetalServerProfileReference struct +type BareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` - // The public SSH key used to encrypt the password. - EncryptionKey *KeyReference `json:"encryption_key,omitempty"` + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The username for the account created at initialization. - Username *string `json:"username,omitempty"` + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property. +// Constants associated with the BareMetalServerProfileReference.ResourceType property. // The resource type. const ( - BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" + BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" ) -func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool { - return true -} - -type BareMetalServerInitializationUserAccountIntf interface { - isaBareMetalServerInitializationUserAccount() bool -} - -// UnmarshalBareMetalServerInitializationUserAccount unmarshals an instance of BareMetalServerInitializationUserAccount from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationUserAccount) - err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) +// UnmarshalBareMetalServerProfileReference unmarshals an instance of BareMetalServerProfileReference from the specified map of raw messages. +func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) @@ -34631,226 +39461,179 @@ func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMess err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) - if err != nil { - err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct -type BareMetalServerLifecycleReason struct { - // A reason code for this lifecycle state: - // - `internal_error`: internal error (contact IBM support) - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Code *string `json:"code" validate:"required"` +// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. +type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { + // The default trusted platform module for a bare metal server with this profile. + Default *string `json:"default,omitempty"` - // An explanation of the reason for this lifecycle state. - Message *string `json:"message" validate:"required"` + // The type for this profile field. + Type *string `json:"type" validate:"required"` - // Link to documentation about the reason for this lifecycle state. - MoreInfo *string `json:"more_info,omitempty"` + // The supported trusted platform module modes. + Values []string `json:"values" validate:"required"` } -// Constants associated with the BareMetalServerLifecycleReason.Code property. -// A reason code for this lifecycle state: -// - `internal_error`: internal error (contact IBM support) -// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM -// support) +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Default property. +// The default trusted platform module for a bare metal server with this profile. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesDefaultDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesDefaultTpm2Const = "tpm_2" +) + +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BareMetalServerLifecycleReasonCodeInternalErrorConst = "internal_error" - BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" ) -// UnmarshalBareMetalServerLifecycleReason unmarshals an instance of BareMetalServerLifecycleReason from the specified map of raw messages. -func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerLifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) +// UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages. +func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { - err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { - err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment struct -// Models which "extend" this model: -// - BareMetalServerNetworkAttachmentByPci -// - BareMetalServerNetworkAttachmentByVlan -type BareMetalServerNetworkAttachment struct { - // The date and time that the bare metal server network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this bare metal server network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network attachment. - ID *string `json:"id" validate:"required"` - - // The network attachment's interface type: - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI attachment - // - Cannot directly use an IEEE 802.1Q tag. - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1Q tag. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - InterfaceType *string `json:"interface_type" validate:"required"` +// BareMetalServerProfileVirtualNetworkInterfacesSupported : Indicates whether this profile supports virtual network interfaces. +type BareMetalServerProfileVirtualNetworkInterfacesSupported struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` - // The lifecycle state of the bare metal server network attachment. - LifecycleState *string `json:"lifecycle_state" validate:"required"` + // The value for this profile field. + Value *bool `json:"value" validate:"required"` +} - // The name for this bare metal server network attachment. The name is unique across all network attachments for the - // bare metal server. - Name *string `json:"name" validate:"required"` +// Constants associated with the BareMetalServerProfileVirtualNetworkInterfacesSupported.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileVirtualNetworkInterfacesSupportedTypeFixedConst = "fixed" +) - // The port speed for this bare metal server network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` +// UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported unmarshals an instance of BareMetalServerProfileVirtualNetworkInterfacesSupported from the specified map of raw messages. +func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileVirtualNetworkInterfacesSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The primary IP address of the virtual network interface for the bare metal server - // network attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` +// BareMetalServerPrototype : BareMetalServerPrototype struct +// Models which "extend" this model: +// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment +// - BareMetalServerPrototypeBareMetalServerByNetworkInterface +type BareMetalServerPrototype struct { + // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified + // value must match one of the bandwidth values in the bare metal server's profile. If unspecified, the default value + // from the profile will be used. + Bandwidth *int64 `json:"bandwidth,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to + // boot. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` - // The subnet of the virtual network interface for the bare metal server network - // attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - // The bare metal server network attachment type. + // The name for this bare metal server. The name must not be used by another bare metal server in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Type *string `json:"type" validate:"required"` + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) + // to use for this bare metal server. + Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` - // The VLAN IDs allowed for `vlan` attachments using this PCI attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for - // network attachments with an `interface_type` of `vlan`. - // - // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, - // the network attachment will be automatically deleted from this bare metal server and a new network attachment with - // the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for - // this network attachment will be automatically be attached to the new network attachment. + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` + + // The VPC this bare metal server will reside in. // - // For the data path to float, the other bare metal server must be in the same - // `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including - // this network attachment's `vlan`. - AllowToFloat *bool `json:"allow_to_float,omitempty"` + // If specified, it must match the VPC for the subnets that the network attachments or + // network interfaces of the bare metal server are attached to. + VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. - Vlan *int64 `json:"vlan,omitempty"` -} + // The zone this bare metal server will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` -// Constants associated with the BareMetalServerNetworkAttachment.InterfaceType property. -// The network attachment's interface type: -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI attachment -// - Cannot directly use an IEEE 802.1Q tag. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1Q tag. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" - BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" -) + // The additional network attachments to create for the bare metal server. + NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` -// Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property. -// The lifecycle state of the bare metal server network attachment. -const ( - BareMetalServerNetworkAttachmentLifecycleStateDeletingConst = "deleting" - BareMetalServerNetworkAttachmentLifecycleStateFailedConst = "failed" - BareMetalServerNetworkAttachmentLifecycleStatePendingConst = "pending" - BareMetalServerNetworkAttachmentLifecycleStateStableConst = "stable" - BareMetalServerNetworkAttachmentLifecycleStateSuspendedConst = "suspended" - BareMetalServerNetworkAttachmentLifecycleStateUpdatingConst = "updating" - BareMetalServerNetworkAttachmentLifecycleStateWaitingConst = "waiting" -) + // The primary network attachment to create for the bare metal server. + PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment,omitempty"` -// Constants associated with the BareMetalServerNetworkAttachment.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkAttachmentResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) + // The additional bare metal server network interfaces to create. + NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` -// Constants associated with the BareMetalServerNetworkAttachment.Type property. -// The bare metal server network attachment type. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" - BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" -) + // The primary bare metal server network interface to create. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} -func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool { +func (*BareMetalServerPrototype) isaBareMetalServerPrototype() bool { return true } -type BareMetalServerNetworkAttachmentIntf interface { - isaBareMetalServerNetworkAttachment() bool +type BareMetalServerPrototypeIntf interface { + isaBareMetalServerPrototype() bool } -// UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachment) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalBareMetalServerPrototype unmarshals an instance of BareMetalServerPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototype) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "initialization-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -34858,541 +39641,695 @@ func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) if err != nil { - err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) if err != nil { - err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) if err != nil { - err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkAttachmentCollection : BareMetalServerNetworkAttachmentCollection struct -type BareMetalServerNetworkAttachmentCollection struct { - // A link to the first page of resources. - First *BareMetalServerNetworkAttachmentCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // The network attachments for the bare metal server. - NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" validate:"required"` +// BareMetalServerStatusReason : BareMetalServerStatusReason struct +type BareMetalServerStatusReason struct { + // The status reason code: + // - `cannot_start`: Failed to start due to an internal error + // - `cannot_start_capacity`: Insufficient capacity within the selected zone + // - `cannot_start_compute`: An error occurred while allocating compute resources + // - `cannot_start_ip_address`: An error occurred while allocating an IP address + // - `cannot_start_network`: An error occurred while allocating network resources + // - `cannot_update_firmware`: An error occurred while updating bare metal server firmware + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BareMetalServerNetworkAttachmentCollectionNext `json:"next,omitempty"` + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` } -// UnmarshalBareMetalServerNetworkAttachmentCollection unmarshals an instance of BareMetalServerNetworkAttachmentCollection from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkAttachmentCollectionFirst) +// Constants associated with the BareMetalServerStatusReason.Code property. +// The status reason code: +// - `cannot_start`: Failed to start due to an internal error +// - `cannot_start_capacity`: Insufficient capacity within the selected zone +// - `cannot_start_compute`: An error occurred while allocating compute resources +// - `cannot_start_ip_address`: An error occurred while allocating an IP address +// - `cannot_start_network`: An error occurred while allocating network resources +// - `cannot_update_firmware`: An error occurred while updating bare metal server firmware +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerStatusReasonCodeCannotReinitializeConst = "cannot_reinitialize" + BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" + BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" + BareMetalServerStatusReasonCodeCannotUpdateFirmwareConst = "cannot_update_firmware" +) + +// UnmarshalBareMetalServerStatusReason unmarshals an instance of BareMetalServerStatusReason from the specified map of raw messages. +func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct +type BareMetalServerTrustedPlatformModule struct { + // Indicates whether the trusted platform module is enabled. + Enabled *bool `json:"enabled" validate:"required"` + + // The trusted platform module (TPM) mode: + // - `disabled`: No TPM functionality + // - `tpm_2`: TPM 2.0 + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Mode *string `json:"mode" validate:"required"` + + // The supported trusted platform module modes. + SupportedModes []string `json:"supported_modes" validate:"required"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModule.Mode property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" +) + +// Constants associated with the BareMetalServerTrustedPlatformModule.SupportedModes property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" + BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModule) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + err = core.SDKErrorf(err, "", "enabled-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "supported_modes-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil - } - return start, nil +// BareMetalServerTrustedPlatformModulePatch : BareMetalServerTrustedPlatformModulePatch struct +type BareMetalServerTrustedPlatformModulePatch struct { + // The trusted platform module mode to use. The specified value must be listed in the bare metal server's + // `supported_modes`. + // + // For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. + Mode *string `json:"mode,omitempty"` } -// BareMetalServerNetworkAttachmentCollectionFirst : A link to the first page of resources. -type BareMetalServerNetworkAttachmentCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} +// Constants associated with the BareMetalServerTrustedPlatformModulePatch.Mode property. +// The trusted platform module mode to use. The specified value must be listed in the bare metal server's +// `supported_modes`. +// +// For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. +const ( + BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2" +) -// UnmarshalBareMetalServerNetworkAttachmentCollectionFirst unmarshals an instance of BareMetalServerNetworkAttachmentCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalBareMetalServerTrustedPlatformModulePatch unmarshals an instance of BareMetalServerTrustedPlatformModulePatch from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModulePatch) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkAttachmentCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerNetworkAttachmentCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` +// asPatch returns a generic map representation of the BareMetalServerTrustedPlatformModulePatch +func (bareMetalServerTrustedPlatformModulePatch *BareMetalServerTrustedPlatformModulePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerTrustedPlatformModulePatch.Mode) { + _patch["mode"] = bareMetalServerTrustedPlatformModulePatch.Mode + } + + return } -// UnmarshalBareMetalServerNetworkAttachmentCollectionNext unmarshals an instance of BareMetalServerNetworkAttachmentCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// BareMetalServerTrustedPlatformModulePrototype : BareMetalServerTrustedPlatformModulePrototype struct +type BareMetalServerTrustedPlatformModulePrototype struct { + // The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's + // `supported_trusted_platform_module_modes`. + // + // If unspecified, the default trusted platform module mode from the profile will be used. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModulePrototype.Mode property. +// The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's +// `supported_trusted_platform_module_modes`. +// +// If unspecified, the default trusted platform module mode from the profile will be used. +const ( + BareMetalServerTrustedPlatformModulePrototypeModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModulePrototypeModeTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerTrustedPlatformModulePrototype unmarshals an instance of BareMetalServerTrustedPlatformModulePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModulePrototype) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkAttachmentPatch : BareMetalServerNetworkAttachmentPatch struct -type BareMetalServerNetworkAttachmentPatch struct { - // The VLAN IDs to allow for `vlan` attachments using this PCI attachment, replacing any existing VLAN IDs. The - // specified values must include IDs for all `vlan` attachments currently using this PCI attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` +// CatalogOfferingIdentity : Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique +// property. +// Models which "extend" this model: +// - CatalogOfferingIdentityCatalogOfferingByCRN +type CatalogOfferingIdentity struct { + // The CRN for this + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn,omitempty"` +} - // The name for this network attachment. The name must not be used by another network attachment for the bare metal - // server. - Name *string `json:"name,omitempty"` +func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { + return true } -// UnmarshalBareMetalServerNetworkAttachmentPatch unmarshals an instance of BareMetalServerNetworkAttachmentPatch from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPatch) - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +type CatalogOfferingIdentityIntf interface { + isaCatalogOfferingIdentity() bool +} + +// UnmarshalCatalogOfferingIdentity unmarshals an instance of CatalogOfferingIdentity from the specified map of raw messages. +func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the BareMetalServerNetworkAttachmentPatch -func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerNetworkAttachmentPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } +// CatalogOfferingVersionIdentity : Identifies a version of a +// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique property. +// Models which "extend" this model: +// - CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN +type CatalogOfferingVersionIdentity struct { + // The CRN for this version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn,omitempty"` +} + +func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool { + return true +} + +type CatalogOfferingVersionIdentityIntf interface { + isaCatalogOfferingVersionIdentity() bool +} + +// UnmarshalCatalogOfferingVersionIdentity unmarshals an instance of CatalogOfferingVersionIdentity from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkAttachmentPrototype : BareMetalServerNetworkAttachmentPrototype struct +// CatalogOfferingVersionPlanIdentity : Identifies a catalog offering version's billing plan by a unique property. // Models which "extend" this model: -// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype -// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype -type BareMetalServerNetworkAttachmentPrototype struct { - // The network attachment's interface type: - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI attachment - // - Cannot directly use an IEEE 802.1Q tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1Q tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The name for this bare metal server network attachment. Names must be unique within the bare metal server the - // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // A virtual network interface for the bare metal server network attachment. This can be - // specified using an existing virtual network interface, or a prototype object for a new - // virtual network interface. - // - // If an existing virtual network interface is specified, it must not be the target of a flow - // log collector. - VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` - - // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for - // network attachments with an `interface_type` of `vlan`. - // - // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, - // the network attachment will be automatically deleted from this bare metal server and a new network attachment with - // the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for - // this network attachment will be automatically be attached to the new network attachment. - // - // For the data path to float, the other bare metal server must be in the same - // `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including - // this network attachment's `vlan`. - AllowToFloat *bool `json:"allow_to_float,omitempty"` - - // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. - Vlan *int64 `json:"vlan,omitempty"` +// - CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN +type CatalogOfferingVersionPlanIdentity struct { + // The CRN for this + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering version's billing plan. + CRN *string `json:"crn,omitempty"` } -// Constants associated with the BareMetalServerNetworkAttachmentPrototype.InterfaceType property. -// The network attachment's interface type: -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI attachment -// - Cannot directly use an IEEE 802.1Q tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1Q tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" - BareMetalServerNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" -) - -func (*BareMetalServerNetworkAttachmentPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { +func (*CatalogOfferingVersionPlanIdentity) isaCatalogOfferingVersionPlanIdentity() bool { return true } -type BareMetalServerNetworkAttachmentPrototypeIntf interface { - isaBareMetalServerNetworkAttachmentPrototype() bool +type CatalogOfferingVersionPlanIdentityIntf interface { + isaCatalogOfferingVersionPlanIdentity() bool } -// UnmarshalBareMetalServerNetworkAttachmentPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototype) - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) +// UnmarshalCatalogOfferingVersionPlanIdentity unmarshals an instance of CatalogOfferingVersionPlanIdentity from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionPlanIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionPlanIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionPlanReference : CatalogOfferingVersionPlanReference struct +type CatalogOfferingVersionPlanReference struct { + // The CRN for this + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering version's billing plan. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` +} + +// UnmarshalCatalogOfferingVersionPlanReference unmarshals an instance of CatalogOfferingVersionPlanReference from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionPlanReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionPlanReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionReference : CatalogOfferingVersionReference struct +type CatalogOfferingVersionReference struct { + // The CRN for this version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalCatalogOfferingVersionReference unmarshals an instance of CatalogOfferingVersionReference from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceIdentity : Identifies a certificate instance by a unique property. +// Models which "extend" this model: +// - CertificateInstanceIdentityByCRN +type CertificateInstanceIdentity struct { + // The CRN for this certificate instance. + CRN *string `json:"crn,omitempty"` +} + +func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { + return true +} + +type CertificateInstanceIdentityIntf interface { + isaCertificateInstanceIdentity() bool + asPatch() map[string]interface{} +} + +// UnmarshalCertificateInstanceIdentity unmarshals an instance of CertificateInstanceIdentity from the specified map of raw messages. +func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the CertificateInstanceIdentity +func (certificateInstanceIdentity *CertificateInstanceIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(certificateInstanceIdentity.CRN) { + _patch["crn"] = certificateInstanceIdentity.CRN + } + + return +} + +// CertificateInstanceReference : CertificateInstanceReference struct +type CertificateInstanceReference struct { + // The CRN for this certificate instance. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalCertificateInstanceReference unmarshals an instance of CertificateInstanceReference from the specified map of raw messages. +func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the bare metal server network attachment. This can be specified using an existing -// virtual network interface, or a prototype object for a new virtual network interface. -// -// If an existing virtual network interface is specified, it must not be the target of a flow log collector. -// Models which "extend" this model: -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on - // this interface. If `true`, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` +// CheckVPNGatewayConnectionsLocalCIDROptions : The CheckVPNGatewayConnectionsLocalCIDR options. +type CheckVPNGatewayConnectionsLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,omitempty"` + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the virtual network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - Can only be attached to a `target` with a `resource_type` of - // `bare_metal_server_network_attachment`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + // The IP address range in CIDR block notation. + CIDR *string `json:"cidr" validate:"required,ne="` - // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or - // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the - // primary IP's subnet. - // - // If reserved IP identities are provided, the specified reserved IPs must be unbound. - // - // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network - // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet - // will be automatically selected and reserved. - Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string +} - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are - // reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` +// NewCheckVPNGatewayConnectionsLocalCIDROptions : Instantiate CheckVPNGatewayConnectionsLocalCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *CheckVPNGatewayConnectionsLocalCIDROptions { + return &CheckVPNGatewayConnectionsLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDR: core.StringPtr(cidr), + } +} - // The primary IP address to bind to the virtual network interface. May be either a - // reserved IP identity, or a reserved IP prototype object which will be used to create a - // new reserved IP. - // - // If a reserved IP identity is provided, the specified reserved IP must be unbound. - // - // If a reserved IP prototype object with an address is provided, the address must be - // available on the virtual network interface's subnet. If no address is specified, - // an available address on the subnet will be automatically selected and reserved. - PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} - // The protocol state filtering mode to use for this virtual network interface. If - // `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target` - // resource type: - // - // - `bare_metal_server_network_attachment`: disabled - // - `instance_network_attachment`: enabled - // - `share_mount_target`: enabled - // - // Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any - // packets that are invalid based on the current connection state and protocol. See [Protocol state filtering - // mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. - ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"` +// SetID : Allow user to set ID +func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionsLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} - // The resource group to use for this virtual network interface. If unspecified, the - // bare metal server's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +// SetCIDR : Allow user to set CIDR +func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayConnectionsLocalCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} - // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC - // for the subnet is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsLocalCIDROptions { + options.Headers = param + return options +} - // The associated subnet. Required if `primary_ip` does not specify a reserved IP - // identity. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +// CheckVPNGatewayConnectionsPeerCIDROptions : The CheckVPNGatewayConnectionsPeerCIDR options. +type CheckVPNGatewayConnectionsPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - // The unique identifier for this virtual network interface. - ID *string `json:"id,omitempty"` + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` - // The URL for this virtual network interface. - Href *string `json:"href,omitempty"` + // The IP address range in CIDR block notation. + CIDR *string `json:"cidr" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionsPeerCIDROptions : Instantiate CheckVPNGatewayConnectionsPeerCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *CheckVPNGatewayConnectionsPeerCIDROptions { + return &CheckVPNGatewayConnectionsPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDR: core.StringPtr(cidr), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionsPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayConnectionsPeerCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsPeerCIDROptions { + options.Headers = param + return options +} + +// CloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. +// Models which "extend" this model: +// - CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName +// - CloudObjectStorageBucketIdentityByCRN +type CloudObjectStorageBucketIdentity struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name,omitempty"` - // The CRN for this virtual network interface. + // The CRN of this Cloud Object Storage bucket. CRN *string `json:"crn,omitempty"` } -// Constants associated with the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface.ProtocolStateFilteringMode property. -// The protocol state filtering mode to use for this virtual network interface. If -// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target` -// resource type: -// -// - `bare_metal_server_network_attachment`: disabled -// - `instance_network_attachment`: enabled -// - `share_mount_target`: enabled -// -// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any -// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering -// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. -const ( - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeAutoConst = "auto" - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeDisabledConst = "disabled" - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeEnabledConst = "enabled" -) - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { +func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { return true } -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { - isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool +type CloudObjectStorageBucketIdentityIntf interface { + isaCloudObjectStorageBucketIdentity() bool } -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo()) - return - } +// UnmarshalCloudObjectStorageBucketIdentity unmarshals an instance of CloudObjectStorageBucketIdentity from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentity) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode) - if err != nil { - err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketReference : CloudObjectStorageBucketReference struct +type CloudObjectStorageBucketReference struct { + // The CRN of this Cloud Object Storage bucket. + CRN *string `json:"crn" validate:"required"` + + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalCloudObjectStorageBucketReference unmarshals an instance of CloudObjectStorageBucketReference from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageObjectReference : CloudObjectStorageObjectReference struct +type CloudObjectStorageObjectReference struct { + // The name of this Cloud Object Storage object. Names are unique within a Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalCloudObjectStorageObjectReference unmarshals an instance of CloudObjectStorageObjectReference from the specified map of raw messages. +func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageObjectReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkAttachmentReference : BareMetalServerNetworkAttachmentReference struct -type BareMetalServerNetworkAttachmentReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` +// ClusterNetwork : ClusterNetwork struct +type ClusterNetwork struct { + // The date and time that the cluster network was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this bare metal server network attachment. + // The CRN for this cluster network. + CRN *string `json:"crn" validate:"required"` + + // The URL for this cluster network. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server network attachment. + // The unique identifier for this cluster network. ID *string `json:"id" validate:"required"` - // The name for this bare metal server network attachment. The name is unique across all network attachments for the - // bare metal server. + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the cluster network. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this cluster network. The name must not be used by another cluster network in the region. Name *string `json:"name" validate:"required"` - // The primary IP address of the virtual network interface for the bare metal server - // network attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + // The profile for this cluster network. + Profile *ClusterNetworkProfileReference `json:"profile" validate:"required"` + + // The resource group for this cluster network. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The subnet of the virtual network interface for the bare metal server network - // attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` + // The IP address ranges available for subnets for this cluster network. + SubnetPrefixes []ClusterNetworkSubnetPrefix `json:"subnet_prefixes" validate:"required"` - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + // The VPC this cluster network resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this cluster network resides in. + Zone *ZoneReference `json:"zone" validate:"required"` } -// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property. +// Constants associated with the ClusterNetwork.LifecycleState property. +// The lifecycle state of the cluster network. +const ( + ClusterNetworkLifecycleStateDeletingConst = "deleting" + ClusterNetworkLifecycleStateFailedConst = "failed" + ClusterNetworkLifecycleStatePendingConst = "pending" + ClusterNetworkLifecycleStateStableConst = "stable" + ClusterNetworkLifecycleStateSuspendedConst = "suspended" + ClusterNetworkLifecycleStateUpdatingConst = "updating" + ClusterNetworkLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ClusterNetwork.ResourceType property. // The resource type. const ( - BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" + ClusterNetworkResourceTypeClusterNetworkConst = "cluster_network" ) -// UnmarshalBareMetalServerNetworkAttachmentReference unmarshals an instance of BareMetalServerNetworkAttachmentReference from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) +// UnmarshalClusterNetwork unmarshals an instance of ClusterNetwork from the specified map of raw messages. +func UnmarshalClusterNetwork(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetwork) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "href", &obj.Href) @@ -35405,349 +40342,93 @@ func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMes err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkLifecycleReason) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalClusterNetworkProfileReference) if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalModel(m, "subnet_prefixes", &obj.SubnetPrefixes, UnmarshalClusterNetworkSubnetPrefix) if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnet_prefixes-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct -// Models which "extend" this model: -// - BareMetalServerNetworkInterfaceByHiperSocket -// - BareMetalServerNetworkInterfaceByPci -// - BareMetalServerNetworkInterfaceByVlan -type BareMetalServerNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on - // the attached virtual network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. - // - // If this bare metal server has network attachments, this network interface was created as a [read-only - // representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) when its corresponding - // network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on - // the attached virtual network interface. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the floating IPs are associated - // with the attached virtual network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the identifier is that of the - // corresponding network attachment. - ID *string `json:"id" validate:"required"` - - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1Q tag. - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1Q tag. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the interface type is that of the - // corresponding network attachment. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be empty. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the MAC address is that of the - // attached virtual network interface. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the name matches its corresponding - // network attachment. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the port speed is that of its - // corresponding network attachment. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the security groups are associated - // with the attached virtual network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a read-only representation of its - // corresponding network attachment and its attached virtual network interface, and the status is [computed from - // them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network interface type. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the type is that of its - // corresponding network attachment. - Type *string `json:"type" validate:"required"` - - // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the VLAN IDs match the - // `allow_vlans` of the corresponding network attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for - // network interfaces with an `interface_type` of `vlan`. - // - // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, - // the network interface will be automatically deleted from this bare metal server and a new network interface with the - // same `id`, `name` and `vlan` will be created on the other bare metal server. - // - // For the data path to float, the other bare metal server must be in the same - // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including - // this network interface's `vlan`. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the value of this property matches - // that of the `allow_to_float` property of the corresponding network attachment. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - - // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of - // the corresponding network attachment. - Vlan *int64 `json:"vlan,omitempty"` -} - -// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1Q tag. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1Q tag. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. -// -// If this bare metal server has network attachments, this network interface is a -// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its -// corresponding network attachment and its attached virtual network interface, and the interface type is that of the -// corresponding network attachment. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" -) - -// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// Constants associated with the BareMetalServerNetworkInterface.Status property. -// The status of the bare metal server network interface. -// -// If this bare metal server has network attachments, this network interface is a read-only representation of its -// corresponding network attachment and its attached virtual network interface, and the status is [computed from -// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). -const ( - BareMetalServerNetworkInterfaceStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceStatusPendingConst = "pending" -) - -// Constants associated with the BareMetalServerNetworkInterface.Type property. -// The bare metal server network interface type. -// -// If this bare metal server has network attachments, this network interface is a -// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its -// corresponding network attachment and its attached virtual network interface, and the type is that of its -// corresponding network attachment. -const ( - BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" -) - -func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { - return true -} - -type BareMetalServerNetworkInterfaceIntf interface { - isaBareMetalServerNetworkInterface() bool -} - -// UnmarshalBareMetalServerNetworkInterface unmarshals an instance of BareMetalServerNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "interface_type", &discValue) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'interface_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByHiperSocket-error", common.GetComponentInfo()) - } - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByPci-error", common.GetComponentInfo()) - } - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByVlan-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct -type BareMetalServerNetworkInterfaceCollection struct { +// ClusterNetworkCollection : ClusterNetworkCollection struct +type ClusterNetworkCollection struct { + // A page of cluster networks. + ClusterNetworks []ClusterNetwork `json:"cluster_networks" validate:"required"` + // A link to the first page of resources. - First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // The network interfaces for the bare metal server. - NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` - // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkInterfaceCollectionFirst) +// UnmarshalClusterNetworkCollection unmarshals an instance of ClusterNetworkCollection from the specified map of raw messages. +func UnmarshalClusterNetworkCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkCollection) + err = core.UnmarshalModel(m, "cluster_networks", &obj.ClusterNetworks, UnmarshalClusterNetwork) if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cluster_networks-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -35762,7 +40443,7 @@ func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMes } // Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { +func (resp *ClusterNetworkCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -35776,88 +40457,104 @@ func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, return start, nil } -// BareMetalServerNetworkInterfaceCollectionFirst : A link to the first page of resources. -type BareMetalServerNetworkInterfaceCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceCollectionFirst unmarshals an instance of BareMetalServerNetworkInterfaceCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerNetworkInterfaceCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceCollectionNext unmarshals an instance of BareMetalServerNetworkInterfaceCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} +// ClusterNetworkInterface : The associated cluster network subnet. +type ClusterNetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this cluster network interface. If `false`, source IP spoofing is + // prevented on this cluster network interface. If `true`, source IP spoofing is allowed on this cluster network + // interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` -// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct -type BareMetalServerNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on - // the attached virtual network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. + AutoDelete *bool `json:"auto_delete" validate:"required"` - // The VLAN IDs to allow for `vlan` interfaces using this PCI interface, replacing any existing VLAN IDs. The specified - // values must include IDs for all `vlan` interfaces currently using this PCI interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + // The date and time that the cluster network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: // - The VPC infrastructure performs any needed NAT operations. // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, + // - Packets are passed unchanged to/from the virtual network interface, // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The URL for this cluster network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this cluster network interface. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkInterfaceLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the cluster network interface. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The MAC address of the cluster network interface. May be absent if + // `lifecycle_state` is `pending`. + MacAddress *string `json:"mac_address,omitempty"` + + // The name for this cluster network interface. The name is unique across all interfaces in the cluster network. + Name *string `json:"name" validate:"required"` + + // The cluster network subnet reserved IP for this cluster network interface. + PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *ClusterNetworkSubnetReference `json:"subnet,omitempty"` + + // The target of this cluster network interface. // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on - // the attached virtual network interface. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + // If absent, this cluster network interface is not attached to a target. + // + // The resources supported by this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Target ClusterNetworkInterfaceTargetIntf `json:"target,omitempty"` - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. - Name *string `json:"name,omitempty"` + // The VPC this cluster network interface resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this cluster network interface resides in. + Zone *ZoneReference `json:"zone" validate:"required"` } -// UnmarshalBareMetalServerNetworkInterfacePatch unmarshals an instance of BareMetalServerNetworkInterfacePatch from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePatch) +// Constants associated with the ClusterNetworkInterface.LifecycleState property. +// The lifecycle state of the cluster network interface. +const ( + ClusterNetworkInterfaceLifecycleStateDeletingConst = "deleting" + ClusterNetworkInterfaceLifecycleStateFailedConst = "failed" + ClusterNetworkInterfaceLifecycleStatePendingConst = "pending" + ClusterNetworkInterfaceLifecycleStateStableConst = "stable" + ClusterNetworkInterfaceLifecycleStateSuspendedConst = "suspended" + ClusterNetworkInterfaceLifecycleStateUpdatingConst = "updating" + ClusterNetworkInterfaceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ClusterNetworkInterface.ResourceType property. +// The resource type. +const ( + ClusterNetworkInterfaceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" +) + +// UnmarshalClusterNetworkInterface unmarshals an instance of ClusterNetworkInterface from the specified map of raw messages. +func UnmarshalClusterNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterface) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { - err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) @@ -35865,442 +40562,285 @@ func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkInterfaceLifecycleReason) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + err = core.SDKErrorf(err, "", "mac_address-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch -func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerNetworkInterfacePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkSubnetReservedIPReference) + if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return } - return -} - -// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct -// Models which "extend" this model: -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype -type BareMetalServerNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on - // the attached virtual network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on - // the attached virtual network interface. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1Q tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1Q tag. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The primary IP address to bind to the bare metal server network interface. This can be - // specified using an existing reserved IP, or a prototype object for a new reserved IP. - // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the bare metal server network interface's subnet. Otherwise, an - // available address on the subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for - // network interfaces with an `interface_type` of `vlan`. - // - // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, - // the network interface will be automatically deleted from this bare metal server and a new network interface with the - // same `id`, `name` and `vlan` will be created on the other bare metal server. - // - // For the data path to float, the other bare metal server must be in the same - // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including - // this network interface's `vlan`. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the value of this property matches - // that of the `allow_to_float` property of the corresponding network attachment. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - - // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of - // the corresponding network attachment. - Vlan *int64 `json:"vlan,omitempty"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1Q tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1Q tag. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" -) - -func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { - return true -} - -type BareMetalServerNetworkInterfacePrototypeIntf interface { - isaBareMetalServerNetworkInterfacePrototype() bool -} - -// UnmarshalBareMetalServerNetworkInterfacePrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "interface_type", &discValue) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference) if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'interface_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalClusterNetworkInterfaceTarget) + if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype-error", common.GetComponentInfo()) - } - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype-error", common.GetComponentInfo()) - } - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerPatch : BareMetalServerPatch struct -type BareMetalServerPatch struct { - // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified - // value must match one of the bandwidth values in the bare metal server's profile. - Bandwidth *int64 `json:"bandwidth,omitempty"` +// ClusterNetworkInterfaceCollection : ClusterNetworkInterfaceCollection struct +type ClusterNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server - // will fail to boot. - // - // For `enable_secure_boot` to be changed, the bare metal server `status` must be - // `stopped`. - EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // A page of cluster network interfaces. + Interfaces []ClusterNetworkInterface `json:"interfaces" validate:"required"` - // The name for this bare metal server. The name must not be used by another bare metal server in the region. Changing - // the name will not affect the system hostname. - Name *string `json:"name,omitempty"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages. -func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPatch) - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) +// UnmarshalClusterNetworkInterfaceCollection unmarshals an instance of ClusterNetworkInterfaceCollection from the specified map of raw messages. +func UnmarshalClusterNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfaceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + err = core.UnmarshalModel(m, "interfaces", &obj.Interfaces, UnmarshalClusterNetworkInterface) if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "interfaces-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the BareMetalServerPatch -func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ClusterNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil } + start, err := core.GetQueryParam(resp.Next.Href, "start") if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil } - return + return start, nil } -// BareMetalServerPrimaryNetworkAttachmentPrototype : BareMetalServerPrimaryNetworkAttachmentPrototype struct -// Models which "extend" this model: -// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype -type BareMetalServerPrimaryNetworkAttachmentPrototype struct { - // The network attachment's interface type: - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI attachment - // - Cannot directly use an IEEE 802.1Q tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type,omitempty"` - - // The name for this bare metal server network attachment. Names must be unique within the bare metal server the - // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // A virtual network interface for the bare metal server network attachment. This can be - // specified using an existing virtual network interface, or a prototype object for a new - // virtual network interface. +// ClusterNetworkInterfaceLifecycleReason : ClusterNetworkInterfaceLifecycleReason struct +type ClusterNetworkInterfaceLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) // - // If an existing virtual network interface is specified, it must not be the target of a flow - // log collector. - VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` - // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + // An explanation of the reason for this lifecycle state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this lifecycle state. + MoreInfo *string `json:"more_info,omitempty"` } -// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototype.InterfaceType property. -// The network attachment's interface type: -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI attachment -// - Cannot directly use an IEEE 802.1Q tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +// Constants associated with the ClusterNetworkInterfaceLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `internal_error`: internal error (contact IBM support) +// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM +// support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" + ClusterNetworkInterfaceLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkInterfaceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) -func (*BareMetalServerPrimaryNetworkAttachmentPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { - return true -} - -type BareMetalServerPrimaryNetworkAttachmentPrototypeIntf interface { - isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool -} - -// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkAttachmentPrototype) - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) +// UnmarshalClusterNetworkInterfaceLifecycleReason unmarshals an instance of ClusterNetworkInterfaceLifecycleReason from the specified map of raw messages. +func UnmarshalClusterNetworkInterfaceLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfaceLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkInterfacePatch : ClusterNetworkInterfacePatch struct +type ClusterNetworkInterfacePatch struct { + // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. Must be + // `false` if the cluster network interface is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this cluster network interface. The name must not be used by another interface in the cluster network. + // Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalClusterNetworkInterfacePatch unmarshals an instance of ClusterNetworkInterfacePatch from the specified map of raw messages. +func UnmarshalClusterNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { - err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct -type BareMetalServerPrimaryNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on - // the attached virtual network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and the VLAN IDs match the - // `allow_vlans` of the corresponding network attachment. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` +// AsPatch returns a generic map representation of the ClusterNetworkInterfacePatch +func (clusterNetworkInterfacePatch *ClusterNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(clusterNetworkInterfacePatch.AutoDelete) { + _patch["auto_delete"] = clusterNetworkInterfacePatch.AutoDelete + } + if !core.IsNil(clusterNetworkInterfacePatch.Name) { + _patch["name"] = clusterNetworkInterfacePatch.Name + } - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - // - // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its - // corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on - // the attached virtual network interface. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + return +} - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system. - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1Q tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type,omitempty"` +// ClusterNetworkInterfacePrimaryIPPrototype : ClusterNetworkInterfacePrimaryIPPrototype struct +// Models which "extend" this model: +// - ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext +// - ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext +type ClusterNetworkInterfacePrimaryIPPrototype struct { + // The unique identifier for this cluster network subnet reserved IP. + ID *string `json:"id,omitempty"` - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The URL for this cluster network subnet reserved IP. + Href *string `json:"href,omitempty"` - // The primary IP address to bind to the bare metal server network interface. This can be - // specified using an existing reserved IP, or a prototype object for a new reserved IP. + // The IP address to reserve, which must not already be reserved on the subnet. // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the bare metal server network interface's subnet. Otherwise, an - // available address on the subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` -} - -// Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1Q tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" -) + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` -// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) { - _model = &BareMetalServerPrimaryNetworkInterfacePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return + // Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target` + // is deleted, or the cluster network subnet reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this cluster network subnet reserved IP. The name must not be used by another reserved IP in the + // cluster network subnet. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + // If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` } -// UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype unmarshals an instance of BareMetalServerPrimaryNetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkInterfacePrototype) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) +func (*ClusterNetworkInterfacePrimaryIPPrototype) isaClusterNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +type ClusterNetworkInterfacePrimaryIPPrototypeIntf interface { + isaClusterNetworkInterfacePrimaryIPPrototype() bool +} + +// UnmarshalClusterNetworkInterfacePrimaryIPPrototype unmarshals an instance of ClusterNetworkInterfacePrimaryIPPrototype from the specified map of raw messages. +func UnmarshalClusterNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfacePrimaryIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -36308,110 +40848,46 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfile : BareMetalServerProfile struct -type BareMetalServerProfile struct { - Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"` - - // The console type configuration for a bare metal server with this profile. - ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"` - - CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"` - - CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"` - - CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` - - // The disks for a bare metal server with this profile. - Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` - - // The product family this bare metal server profile belongs to. - Family *string `json:"family" validate:"required"` +// ClusterNetworkInterfaceReference : The associated cluster network subnet. +type ClusterNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` - // The URL for this bare metal server profile. + // The URL for this cluster network interface. Href *string `json:"href" validate:"required"` - Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` + // The unique identifier for this cluster network interface. + ID *string `json:"id" validate:"required"` - // The name for this bare metal server profile. + // The name for this cluster network interface. The name is unique across all interfaces in the cluster network. Name *string `json:"name" validate:"required"` - NetworkAttachmentCount BareMetalServerProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` - - NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` - - OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` + // The primary IP for this cluster network interface. + PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The supported trusted platform module modes for this bare metal server profile. - SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` - - // Indicates whether this profile supports virtual network interfaces. - VirtualNetworkInterfacesSupported *BareMetalServerProfileVirtualNetworkInterfacesSupported `json:"virtual_network_interfaces_supported" validate:"required"` + Subnet *ClusterNetworkSubnetReference `json:"subnet" validate:"required"` } -// Constants associated with the BareMetalServerProfile.ResourceType property. +// Constants associated with the ClusterNetworkInterfaceReference.ResourceType property. // The resource type. const ( - BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + ClusterNetworkInterfaceReferenceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" ) -// UnmarshalBareMetalServerProfile unmarshals an instance of BareMetalServerProfile from the specified map of raw messages. -func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfile) - err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalBareMetalServerProfileBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) - if err != nil { - err = core.SDKErrorf(err, "", "console_types-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) - if err != nil { - err = core.SDKErrorf(err, "", "cpu_architecture-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) - if err != nil { - err = core.SDKErrorf(err, "", "cpu_core_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) - if err != nil { - err = core.SDKErrorf(err, "", "cpu_socket_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) - if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) +// UnmarshalClusterNetworkInterfaceReference unmarshals an instance of ClusterNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalClusterNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { - err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "href", &obj.Href) @@ -36419,9 +40895,9 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -36429,19 +40905,9 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalBareMetalServerProfileNetworkAttachmentCount) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachment_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) - if err != nil { - err = core.SDKErrorf(err, "", "network_interface_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkSubnetReservedIPReference) if err != nil { - err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) @@ -36449,338 +40915,260 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) - if err != nil { - err = core.SDKErrorf(err, "", "supported_trusted_platform_module_modes-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference) if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interfaces_supported-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct +// ClusterNetworkInterfaceTarget : The target of this cluster network interface. +// +// If absent, this cluster network interface is not attached to a target. +// +// The resources supported by this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. // Models which "extend" this model: -// - BareMetalServerProfileBandwidthFixed -// - BareMetalServerProfileBandwidthRange -// - BareMetalServerProfileBandwidthEnum -// - BareMetalServerProfileBandwidthDependent -type BareMetalServerProfileBandwidth struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` +// - ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext +type ClusterNetworkInterfaceTarget struct { + // The URL for this instance cluster network attachment. + Href *string `json:"href,omitempty"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The unique identifier for this instance cluster network attachment. + ID *string `json:"id,omitempty"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The name for this instance cluster network attachment. The name is unique across all network attachments for the + // instance. + Name *string `json:"name,omitempty"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` } -// Constants associated with the BareMetalServerProfileBandwidth.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkInterfaceTarget.ResourceType property. +// The resource type. const ( - BareMetalServerProfileBandwidthTypeFixedConst = "fixed" + ClusterNetworkInterfaceTargetResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment" ) -func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { +func (*ClusterNetworkInterfaceTarget) isaClusterNetworkInterfaceTarget() bool { return true } -type BareMetalServerProfileBandwidthIntf interface { - isaBareMetalServerProfileBandwidth() bool +type ClusterNetworkInterfaceTargetIntf interface { + isaClusterNetworkInterfaceTarget() bool } -// UnmarshalBareMetalServerProfileBandwidth unmarshals an instance of BareMetalServerProfileBandwidth from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidth) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) +// UnmarshalClusterNetworkInterfaceTarget unmarshals an instance of ClusterNetworkInterfaceTarget from the specified map of raw messages. +func UnmarshalClusterNetworkInterfaceTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfaceTarget) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct -type BareMetalServerProfileCpuArchitecture struct { - // The default CPU architecture for a bare metal server with this profile. - Default *string `json:"default,omitempty"` +// ClusterNetworkLifecycleReason : ClusterNetworkLifecycleReason struct +type ClusterNetworkLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` - // The type for this profile field. - Type *string `json:"type" validate:"required"` + // An explanation of the reason for this lifecycle state. + Message *string `json:"message" validate:"required"` - // The CPU architecture for a bare metal server with this profile. - Value *string `json:"value" validate:"required"` + // Link to documentation about the reason for this lifecycle state. + MoreInfo *string `json:"more_info,omitempty"` } -// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `internal_error`: internal error (contact IBM support) +// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM +// support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" + ClusterNetworkLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) -// UnmarshalBareMetalServerProfileCpuArchitecture unmarshals an instance of BareMetalServerProfileCpuArchitecture from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuArchitecture) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) +// UnmarshalClusterNetworkLifecycleReason unmarshals an instance of ClusterNetworkLifecycleReason from the specified map of raw messages. +func UnmarshalClusterNetworkLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct -// Models which "extend" this model: -// - BareMetalServerProfileCpuCoreCountFixed -// - BareMetalServerProfileCpuCoreCountRange -// - BareMetalServerProfileCpuCoreCountEnum -// - BareMetalServerProfileCpuCoreCountDependent -type BareMetalServerProfileCpuCoreCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -type BareMetalServerProfileCpuCoreCountIntf interface { - isaBareMetalServerProfileCpuCoreCount() bool +// ClusterNetworkPatch : ClusterNetworkPatch struct +type ClusterNetworkPatch struct { + // The name for this cluster network. The name must not be used by another cluster network in the region. Names + // starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` } -// UnmarshalBareMetalServerProfileCpuCoreCount unmarshals an instance of BareMetalServerProfileCpuCoreCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCount) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) +// UnmarshalClusterNetworkPatch unmarshals an instance of ClusterNetworkPatch from the specified map of raw messages. +func UnmarshalClusterNetworkPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileCpuSocketCount : BareMetalServerProfileCpuSocketCount struct -// Models which "extend" this model: -// - BareMetalServerProfileCpuSocketCountFixed -// - BareMetalServerProfileCpuSocketCountRange -// - BareMetalServerProfileCpuSocketCountEnum -// - BareMetalServerProfileCpuSocketCountDependent -type BareMetalServerProfileCpuSocketCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// AsPatch returns a generic map representation of the ClusterNetworkPatch +func (clusterNetworkPatch *ClusterNetworkPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(clusterNetworkPatch.Name) { + _patch["name"] = clusterNetworkPatch.Name + } - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + return +} - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` +// ClusterNetworkProfile : ClusterNetworkProfile struct +type ClusterNetworkProfile struct { + // The product family this cluster network profile belongs to. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Family *string `json:"family" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The URL for this cluster network profile. + Href *string `json:"href" validate:"required"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The globally unique name for this cluster network profile. + Name *string `json:"name" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The instance profiles that support this cluster network profile. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // Zones in this region that support this cluster network profile. + Zones []ZoneReference `json:"zones" validate:"required"` } -// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkProfile.Family property. +// The product family this cluster network profile belongs to. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" + ClusterNetworkProfileFamilyVelaConst = "vela" ) -func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -type BareMetalServerProfileCpuSocketCountIntf interface { - isaBareMetalServerProfileCpuSocketCount() bool -} +// Constants associated with the ClusterNetworkProfile.ResourceType property. +// The resource type. +const ( + ClusterNetworkProfileResourceTypeClusterNetworkProfileConst = "cluster_network_profile" +) -// UnmarshalBareMetalServerProfileCpuSocketCount unmarshals an instance of BareMetalServerProfileCpuSocketCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCount) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) +// UnmarshalClusterNetworkProfile unmarshals an instance of ClusterNetworkProfile from the specified map of raw messages. +func UnmarshalClusterNetworkProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct -type BareMetalServerProfileCollection struct { +// ClusterNetworkProfileCollection : ClusterNetworkProfileCollection struct +type ClusterNetworkProfileCollection struct { // A link to the first page of resources. - First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BareMetalServerProfileCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` - // A page of bare metal server profiles. - Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` + // A page of cluster network profiles. + Profiles []ClusterNetworkProfile `json:"profiles" validate:"required"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBareMetalServerProfileCollection unmarshals an instance of BareMetalServerProfileCollection from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerProfileCollectionFirst) +// UnmarshalClusterNetworkProfileCollection unmarshals an instance of ClusterNetworkProfileCollection from the specified map of raw messages. +func UnmarshalClusterNetworkProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -36790,12 +41178,12 @@ func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalClusterNetworkProfile) if err != nil { err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) return @@ -36810,7 +41198,7 @@ func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, res } // Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { +func (resp *ClusterNetworkProfileCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -36824,370 +41212,373 @@ func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { return start, nil } -// BareMetalServerProfileCollectionFirst : A link to the first page of resources. -type BareMetalServerProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerProfileCollectionFirst unmarshals an instance of BareMetalServerProfileCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} +// ClusterNetworkProfileIdentity : Identifies an cluster network profile by a unique property. +// Models which "extend" this model: +// - ClusterNetworkProfileIdentityByName +// - ClusterNetworkProfileIdentityByHref +type ClusterNetworkProfileIdentity struct { + // The globally unique name for this cluster network profile. + Name *string `json:"name,omitempty"` -// BareMetalServerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` + // The URL for this cluster network profile. + Href *string `json:"href,omitempty"` } -// UnmarshalBareMetalServerProfileCollectionNext unmarshals an instance of BareMetalServerProfileCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +func (*ClusterNetworkProfileIdentity) isaClusterNetworkProfileIdentity() bool { + return true } -// BareMetalServerProfileConsoleTypes : The console type configuration for a bare metal server with this profile. -type BareMetalServerProfileConsoleTypes struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The console types for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` +type ClusterNetworkProfileIdentityIntf interface { + isaClusterNetworkProfileIdentity() bool } -// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" -) - -// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. -// A console type. -const ( - BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" - BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" -) - -// UnmarshalBareMetalServerProfileConsoleTypes unmarshals an instance of BareMetalServerProfileConsoleTypes from the specified map of raw messages. -func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileConsoleTypes) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// UnmarshalClusterNetworkProfileIdentity unmarshals an instance of ClusterNetworkProfileIdentity from the specified map of raw messages. +func UnmarshalClusterNetworkProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileDisk : Disks provided by this profile. -type BareMetalServerProfileDisk struct { - Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` +// ClusterNetworkProfileReference : ClusterNetworkProfileReference struct +type ClusterNetworkProfileReference struct { + // The URL for this cluster network profile. + Href *string `json:"href" validate:"required"` - Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` + // The globally unique name for this cluster network profile. + Name *string `json:"name" validate:"required"` - SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// UnmarshalBareMetalServerProfileDisk unmarshals an instance of BareMetalServerProfileDisk from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDisk) - err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity) +// Constants associated with the ClusterNetworkProfileReference.ResourceType property. +// The resource type. +const ( + ClusterNetworkProfileReferenceResourceTypeClusterNetworkProfileConst = "cluster_network_profile" +) + +// UnmarshalClusterNetworkProfileReference unmarshals an instance of ClusterNetworkProfileReference from the specified map of raw messages. +func UnmarshalClusterNetworkProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "supported_interface_types-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct -// Models which "extend" this model: -// - BareMetalServerProfileDiskQuantityFixed -// - BareMetalServerProfileDiskQuantityRange -// - BareMetalServerProfileDiskQuantityEnum -// - BareMetalServerProfileDiskQuantityDependent -type BareMetalServerProfileDiskQuantity struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` +// ClusterNetworkReference : ClusterNetworkReference struct +type ClusterNetworkReference struct { + // The CRN for this cluster network. + CRN *string `json:"crn" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The URL for this cluster network. + Href *string `json:"href" validate:"required"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The unique identifier for this cluster network. + ID *string `json:"id" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The name for this cluster network. The name must not be used by another cluster network in the region. + Name *string `json:"name" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkReference.ResourceType property. +// The resource type. const ( - BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" + ClusterNetworkReferenceResourceTypeClusterNetworkConst = "cluster_network" ) -func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -type BareMetalServerProfileDiskQuantityIntf interface { - isaBareMetalServerProfileDiskQuantity() bool -} - -// UnmarshalBareMetalServerProfileDiskQuantity unmarshals an instance of BareMetalServerProfileDiskQuantity from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantity) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) +// UnmarshalClusterNetworkReference unmarshals an instance of ClusterNetworkReference from the specified map of raw messages. +func UnmarshalClusterNetworkReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileDiskSize : BareMetalServerProfileDiskSize struct -// Models which "extend" this model: -// - BareMetalServerProfileDiskSizeFixed -// - BareMetalServerProfileDiskSizeRange -// - BareMetalServerProfileDiskSizeEnum -// - BareMetalServerProfileDiskSizeDependent -type BareMetalServerProfileDiskSize struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// ClusterNetworkSubnet : ClusterNetworkSubnet struct +type ClusterNetworkSubnet struct { + // The number of IPv4 addresses in this cluster network subnet that are not in use, and have not been reserved by the + // user or the provider. + AvailableIpv4AddressCount *int64 `json:"available_ipv4_address_count" validate:"required"` - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + // The date and time that the cluster network subnet was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // The URL for this cluster network subnet. + Href *string `json:"href" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The unique identifier for this cluster network subnet. + ID *string `json:"id" validate:"required"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The IP version for this cluster network subnet. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + IPVersion *string `json:"ip_version" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The IPv4 range of this cluster network subnet, expressed in CIDR format. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkSubnetLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the cluster network subnet. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this cluster network subnet. The name is unique across all cluster network subnets in the cluster + // network. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The total number of IPv4 addresses in this cluster network subnet. + // + // Note: This is calculated as 2(32 - prefix length). For example, the prefix length `/24` gives:
+ // 2(32 - 24) = 28 = 256 addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` } -// Constants associated with the BareMetalServerProfileDiskSize.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkSubnet.IPVersion property. +// The IP version for this cluster network subnet. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" + ClusterNetworkSubnetIPVersionIpv4Const = "ipv4" ) -func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { - return true -} +// Constants associated with the ClusterNetworkSubnet.LifecycleState property. +// The lifecycle state of the cluster network subnet. +const ( + ClusterNetworkSubnetLifecycleStateDeletingConst = "deleting" + ClusterNetworkSubnetLifecycleStateFailedConst = "failed" + ClusterNetworkSubnetLifecycleStatePendingConst = "pending" + ClusterNetworkSubnetLifecycleStateStableConst = "stable" + ClusterNetworkSubnetLifecycleStateSuspendedConst = "suspended" + ClusterNetworkSubnetLifecycleStateUpdatingConst = "updating" + ClusterNetworkSubnetLifecycleStateWaitingConst = "waiting" +) -type BareMetalServerProfileDiskSizeIntf interface { - isaBareMetalServerProfileDiskSize() bool -} +// Constants associated with the ClusterNetworkSubnet.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetResourceTypeClusterNetworkSubnetConst = "cluster_network_subnet" +) -// UnmarshalBareMetalServerProfileDiskSize unmarshals an instance of BareMetalServerProfileDiskSize from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSize) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// UnmarshalClusterNetworkSubnet unmarshals an instance of ClusterNetworkSubnet from the specified map of raw messages. +func UnmarshalClusterNetworkSubnet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnet) + err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "available_ipv4_address_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ipv4_cidr_block-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkSubnetLifecycleReason) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct -type BareMetalServerProfileDiskSupportedInterfaces struct { - // The default value for this profile field. - Default *string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` +// ClusterNetworkSubnetCollection : ClusterNetworkSubnetCollection struct +type ClusterNetworkSubnetCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` - // The supported disk interfaces used for attaching the disk. - Values []string `json:"values" validate:"required"` -} + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The default value for this profile field. -const ( - BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" -) + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" -) + // A page of subnets for the cluster network. + Subnets []ClusterNetworkSubnet `json:"subnets" validate:"required"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. -// The disk attachment interface used: -// - `fcp`: Fiber Channel Protocol -// - `sata`: Serial Advanced Technology Attachment -// - `nvme`: Non-Volatile Memory Express -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" -) + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} -// UnmarshalBareMetalServerProfileDiskSupportedInterfaces unmarshals an instance of BareMetalServerProfileDiskSupportedInterfaces from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSupportedInterfaces) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) +// UnmarshalClusterNetworkSubnetCollection unmarshals an instance of ClusterNetworkSubnetCollection from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalClusterNetworkSubnet) + if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileIdentity : Identifies a bare metal server profile by a unique property. +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ClusterNetworkSubnetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + +// ClusterNetworkSubnetIdentity : Identifies a cluster network subnet by a unique property. // Models which "extend" this model: -// - BareMetalServerProfileIdentityByName -// - BareMetalServerProfileIdentityByHref -type BareMetalServerProfileIdentity struct { - // The name for this bare metal server profile. - Name *string `json:"name,omitempty"` +// - ClusterNetworkSubnetIdentityByID +// - ClusterNetworkSubnetIdentityByHref +type ClusterNetworkSubnetIdentity struct { + // The unique identifier for this cluster network subnet. + ID *string `json:"id,omitempty"` - // The URL for this bare metal server profile. + // The URL for this cluster network subnet. Href *string `json:"href,omitempty"` } -func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { +func (*ClusterNetworkSubnetIdentity) isaClusterNetworkSubnetIdentity() bool { return true } -type BareMetalServerProfileIdentityIntf interface { - isaBareMetalServerProfileIdentity() bool +type ClusterNetworkSubnetIdentityIntf interface { + isaClusterNetworkSubnetIdentity() bool } -// UnmarshalBareMetalServerProfileIdentity unmarshals an instance of BareMetalServerProfileIdentity from the specified map of raw messages. -func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalClusterNetworkSubnetIdentity unmarshals an instance of ClusterNetworkSubnetIdentity from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "href", &obj.Href) @@ -37199,259 +41590,264 @@ func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, resul return } -// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct -// Models which "extend" this model: -// - BareMetalServerProfileMemoryFixed -// - BareMetalServerProfileMemoryRange -// - BareMetalServerProfileMemoryEnum -// - BareMetalServerProfileMemoryDependent -type BareMetalServerProfileMemory struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` +// ClusterNetworkSubnetLifecycleReason : ClusterNetworkSubnetLifecycleReason struct +type ClusterNetworkSubnetLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // An explanation of the reason for this lifecycle state. + Message *string `json:"message" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // Link to documentation about the reason for this lifecycle state. + MoreInfo *string `json:"more_info,omitempty"` } -// Constants associated with the BareMetalServerProfileMemory.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkSubnetLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `internal_error`: internal error (contact IBM support) +// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM +// support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BareMetalServerProfileMemoryTypeFixedConst = "fixed" + ClusterNetworkSubnetLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkSubnetLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) -func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { - return true -} - -type BareMetalServerProfileMemoryIntf interface { - isaBareMetalServerProfileMemory() bool -} - -// UnmarshalBareMetalServerProfileMemory unmarshals an instance of BareMetalServerProfileMemory from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemory) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) +// UnmarshalClusterNetworkSubnetLifecycleReason unmarshals an instance of ClusterNetworkSubnetLifecycleReason from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetPatch : ClusterNetworkSubnetPatch struct +type ClusterNetworkSubnetPatch struct { + // The name for this cluster network subnet. The name must not be used by another cluster network subnet in the cluster + // network. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalClusterNetworkSubnetPatch unmarshals an instance of ClusterNetworkSubnetPatch from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileNetworkAttachmentCount : BareMetalServerProfileNetworkAttachmentCount struct -// Models which "extend" this model: -// - BareMetalServerProfileNetworkAttachmentCountRange -// - BareMetalServerProfileNetworkAttachmentCountDependent -type BareMetalServerProfileNetworkAttachmentCount struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` - - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` +// AsPatch returns a generic map representation of the ClusterNetworkSubnetPatch +func (clusterNetworkSubnetPatch *ClusterNetworkSubnetPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(clusterNetworkSubnetPatch.Name) { + _patch["name"] = clusterNetworkSubnetPatch.Name + } - // The type for this profile field. - Type *string `json:"type,omitempty"` + return } -// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" -) +// ClusterNetworkSubnetPrefix : A range of addresses available for subnets for this cluster network. +type ClusterNetworkSubnetPrefix struct { + // The allocation policy for this subnet prefix: + // - `auto`: Subnets created by total count in this cluster network can use this prefix. + AllocationPolicy *string `json:"allocation_policy" validate:"required"` -func (*BareMetalServerProfileNetworkAttachmentCount) isaBareMetalServerProfileNetworkAttachmentCount() bool { - return true + // The CIDR block for this prefix. + CIDR *string `json:"cidr" validate:"required"` } -type BareMetalServerProfileNetworkAttachmentCountIntf interface { - isaBareMetalServerProfileNetworkAttachmentCount() bool -} +// Constants associated with the ClusterNetworkSubnetPrefix.AllocationPolicy property. +// The allocation policy for this subnet prefix: +// - `auto`: Subnets created by total count in this cluster network can use this prefix. +const ( + ClusterNetworkSubnetPrefixAllocationPolicyAutoConst = "auto" +) -// UnmarshalBareMetalServerProfileNetworkAttachmentCount unmarshals an instance of BareMetalServerProfileNetworkAttachmentCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkAttachmentCount) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) +// UnmarshalClusterNetworkSubnetPrefix unmarshals an instance of ClusterNetworkSubnetPrefix from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetPrefix(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetPrefix) + err = core.UnmarshalPrimitive(m, "allocation_policy", &obj.AllocationPolicy) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allocation_policy-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetPrefixPrototype : ClusterNetworkSubnetPrefixPrototype struct +type ClusterNetworkSubnetPrefixPrototype struct { + // The IPv4 range of the cluster network's subnet prefix, expressed in CIDR format. + // + // The CIDR prefix length must be less than `/29` (at least 8 addresses). + // + // If a range is specified that overlaps with address prefixes in the cluster network's VPC, the operating systems of + // any virtual server instances attaching to this cluster network must be [configured to avoid + // conflicts](https://cloud.ibm.com/docs/vpc?topic=vpc-planning-cluster-network#advanced-consideration). + CIDR *string `json:"cidr,omitempty"` +} + +// UnmarshalClusterNetworkSubnetPrefixPrototype unmarshals an instance of ClusterNetworkSubnetPrefixPrototype from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetPrefixPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetPrefixPrototype) + err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct +// ClusterNetworkSubnetPrototype : ClusterNetworkSubnetPrototype struct // Models which "extend" this model: -// - BareMetalServerProfileNetworkInterfaceCountRange -// - BareMetalServerProfileNetworkInterfaceCountDependent -type BareMetalServerProfileNetworkInterfaceCount struct { - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` +// - ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype +// - ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype +type ClusterNetworkSubnetPrototype struct { + // The IP version(s) to support for this cluster network subnet. + IPVersion *string `json:"ip_version,omitempty"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The name for this cluster network subnet. The name must not be used by another cluster network subnet in the cluster + // network. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The type for this profile field. - Type *string `json:"type,omitempty"` + // The total number of IPv4 addresses required. Must be a power of 2. + // + // A CIDR will be allocated from a subnet prefix in the cluster network that has an + // `allocation_policy` of `auto`. There must be a subnet prefix that has a free CIDR range with at least this number of + // addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count,omitempty"` + + // The IPv4 range of the cluster network subnet, expressed in CIDR format. The prefix length of the cluster network + // subnet's CIDR must be between `/8` (16,777,216 addresses) and `/29` + // (8 addresses). The IPv4 range of the cluster network subnet's CIDR must be within the cluster network's + // `subnet_prefixes`. + // + // The range must not overlap with any of the following reserved address ranges: + // + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses). + Ipv4CIDRBlock *string `json:"ipv4_cidr_block,omitempty"` } -// Constants associated with the BareMetalServerProfileNetworkInterfaceCount.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkSubnetPrototype.IPVersion property. +// The IP version(s) to support for this cluster network subnet. const ( - BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" + ClusterNetworkSubnetPrototypeIPVersionIpv4Const = "ipv4" ) -func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { +func (*ClusterNetworkSubnetPrototype) isaClusterNetworkSubnetPrototype() bool { return true } -type BareMetalServerProfileNetworkInterfaceCountIntf interface { - isaBareMetalServerProfileNetworkInterfaceCount() bool +type ClusterNetworkSubnetPrototypeIntf interface { + isaClusterNetworkSubnetPrototype() bool } -// UnmarshalBareMetalServerProfileNetworkInterfaceCount unmarshals an instance of BareMetalServerProfileNetworkInterfaceCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkInterfaceCount) - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// UnmarshalClusterNetworkSubnetPrototype unmarshals an instance of ClusterNetworkSubnetPrototype from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetPrototype) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileOsArchitecture : BareMetalServerProfileOsArchitecture struct -type BareMetalServerProfileOsArchitecture struct { - // The default OS architecture for a bare metal server with this profile. - Default *string `json:"default" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported OS architecture(s) for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileOsArchitecture.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileOsArchitectureTypeEnumConst = "enum" -) - -// UnmarshalBareMetalServerProfileOsArchitecture unmarshals an instance of BareMetalServerProfileOsArchitecture from the specified map of raw messages. -func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileOsArchitecture) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ipv4_cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileReference : BareMetalServerProfileReference struct -type BareMetalServerProfileReference struct { - // The URL for this bare metal server profile. +// ClusterNetworkSubnetReference : ClusterNetworkSubnetReference struct +type ClusterNetworkSubnetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this cluster network subnet. Href *string `json:"href" validate:"required"` - // The name for this bare metal server profile. + // The unique identifier for this cluster network subnet. + ID *string `json:"id" validate:"required"` + + // The name for this cluster network subnet. The name is unique across all cluster network subnets in the cluster + // network. Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the BareMetalServerProfileReference.ResourceType property. +// Constants associated with the ClusterNetworkSubnetReference.ResourceType property. // The resource type. const ( - BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + ClusterNetworkSubnetReferenceResourceTypeClusterNetworkSubnetConst = "cluster_network_subnet" ) -// UnmarshalBareMetalServerProfileReference unmarshals an instance of BareMetalServerProfileReference from the specified map of raw messages. -func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileReference) +// UnmarshalClusterNetworkSubnetReference unmarshals an instance of ClusterNetworkSubnetReference from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) @@ -37466,175 +41862,118 @@ func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, resu return } -// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. -type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { - // The default trusted platform module for a bare metal server with this profile. - Default *string `json:"default,omitempty"` +// ClusterNetworkSubnetReservedIP : ClusterNetworkSubnetReservedIP struct +type ClusterNetworkSubnetReservedIP struct { + // The IP address. + // + // If the address is pending allocation, the value will be `0.0.0.0`. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. + Address *string `json:"address" validate:"required"` - // The type for this profile field. - Type *string `json:"type" validate:"required"` + // Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target` + // is deleted, or the cluster network subnet reserved IP is unbound. + AutoDelete *bool `json:"auto_delete" validate:"required"` - // The supported trusted platform module modes. - Values []string `json:"values" validate:"required"` -} + // The date and time that the cluster network subnet reserved IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Default property. -// The default trusted platform module for a bare metal server with this profile. -const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesDefaultDisabledConst = "disabled" - BareMetalServerProfileSupportedTrustedPlatformModuleModesDefaultTpm2Const = "tpm_2" -) + // The URL for this cluster network subnet reserved IP. + Href *string `json:"href" validate:"required"` -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. -// The type for this profile field. + // The unique identifier for this cluster network subnet reserved IP. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkSubnetReservedIPLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the cluster network subnet reserved IP. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this cluster network subnet reserved IP. The name is unique across all reserved IPs in a cluster + // network subnet. + Name *string `json:"name" validate:"required"` + + // The owner of the cluster network subnet reserved IP + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Owner *string `json:"owner" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The target this cluster network subnet reserved IP is bound to. + // + // If absent, this cluster network subnet reserved IP is provider-owned or unbound. + Target ClusterNetworkSubnetReservedIPTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the ClusterNetworkSubnetReservedIP.LifecycleState property. +// The lifecycle state of the cluster network subnet reserved IP. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" + ClusterNetworkSubnetReservedIPLifecycleStateDeletingConst = "deleting" + ClusterNetworkSubnetReservedIPLifecycleStateFailedConst = "failed" + ClusterNetworkSubnetReservedIPLifecycleStatePendingConst = "pending" + ClusterNetworkSubnetReservedIPLifecycleStateStableConst = "stable" + ClusterNetworkSubnetReservedIPLifecycleStateSuspendedConst = "suspended" + ClusterNetworkSubnetReservedIPLifecycleStateUpdatingConst = "updating" + ClusterNetworkSubnetReservedIPLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 +// Constants associated with the ClusterNetworkSubnetReservedIP.Owner property. +// The owner of the cluster network subnet reserved IP // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" + ClusterNetworkSubnetReservedIPOwnerProviderConst = "provider" + ClusterNetworkSubnetReservedIPOwnerUserConst = "user" ) -// UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages. -func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// Constants associated with the ClusterNetworkSubnetReservedIP.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetReservedIPResourceTypeClusterNetworkSubnetReservedIPConst = "cluster_network_subnet_reserved_ip" +) + +// UnmarshalClusterNetworkSubnetReservedIP unmarshals an instance of ClusterNetworkSubnetReservedIP from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReservedIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileVirtualNetworkInterfacesSupported : Indicates whether this profile supports virtual network interfaces. -type BareMetalServerProfileVirtualNetworkInterfacesSupported struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *bool `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileVirtualNetworkInterfacesSupported.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileVirtualNetworkInterfacesSupportedTypeFixedConst = "fixed" -) - -// UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported unmarshals an instance of BareMetalServerProfileVirtualNetworkInterfacesSupported from the specified map of raw messages. -func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileVirtualNetworkInterfacesSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrototype : BareMetalServerPrototype struct -// Models which "extend" this model: -// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment -// - BareMetalServerPrototypeBareMetalServerByNetworkInterface -type BareMetalServerPrototype struct { - // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified - // value must match one of the bandwidth values in the bare metal server's profile. If unspecified, the default value - // from the profile will be used. - Bandwidth *int64 `json:"bandwidth,omitempty"` - - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to - // boot. - EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` - - Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - - // The name for this bare metal server. The name must not be used by another bare metal server in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) - // to use for this bare metal server. - Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - - // The VPC this bare metal server will reside in. - // - // If specified, it must match the VPC for the subnets that the network attachments or - // network interfaces of the bare metal server are attached to. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The zone this bare metal server will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the bare metal server. - NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the bare metal server. - PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment,omitempty"` - - // The additional bare metal server network interfaces to create. - NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` - - // The primary bare metal server network interface to create. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*BareMetalServerPrototype) isaBareMetalServerPrototype() bool { - return true -} - -type BareMetalServerPrototypeIntf interface { - isaBareMetalServerPrototype() bool -} - -// UnmarshalBareMetalServerPrototype unmarshals an instance of BareMetalServerPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototype) - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkSubnetReservedIPLifecycleReason) if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { - err = core.SDKErrorf(err, "", "initialization-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -37642,100 +41981,125 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "owner-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalClusterNetworkSubnetReservedIPTarget) if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetReservedIPCollection : ClusterNetworkSubnetReservedIPCollection struct +type ClusterNetworkSubnetReservedIPCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // A page of reserved IPs for the cluster network subnet. + ReservedIps []ClusterNetworkSubnetReservedIP `json:"reserved_ips" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalClusterNetworkSubnetReservedIPCollection unmarshals an instance of ClusterNetworkSubnetReservedIPCollection from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReservedIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReservedIPCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalClusterNetworkSubnetReservedIP) if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "reserved_ips-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerStatusReason : BareMetalServerStatusReason struct -type BareMetalServerStatusReason struct { - // The status reason code: - // - `cannot_start`: Failed to start due to an internal error - // - `cannot_start_capacity`: Insufficient capacity within the selected zone - // - `cannot_start_compute`: An error occurred while allocating compute resources - // - `cannot_start_ip_address`: An error occurred while allocating an IP address - // - `cannot_start_network`: An error occurred while allocating network resources - // - `cannot_update_firmware`: An error occurred while updating bare metal server firmware +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ClusterNetworkSubnetReservedIPCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + +// ClusterNetworkSubnetReservedIPLifecycleReason : ClusterNetworkSubnetReservedIPLifecycleReason struct +type ClusterNetworkSubnetReservedIPLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Code *string `json:"code" validate:"required"` - // An explanation of the status reason. + // An explanation of the reason for this lifecycle state. Message *string `json:"message" validate:"required"` - // Link to documentation about this status reason. + // Link to documentation about the reason for this lifecycle state. MoreInfo *string `json:"more_info,omitempty"` } -// Constants associated with the BareMetalServerStatusReason.Code property. -// The status reason code: -// - `cannot_start`: Failed to start due to an internal error -// - `cannot_start_capacity`: Insufficient capacity within the selected zone -// - `cannot_start_compute`: An error occurred while allocating compute resources -// - `cannot_start_ip_address`: An error occurred while allocating an IP address -// - `cannot_start_network`: An error occurred while allocating network resources -// - `cannot_update_firmware`: An error occurred while updating bare metal server firmware +// Constants associated with the ClusterNetworkSubnetReservedIPLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `internal_error`: internal error (contact IBM support) +// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM +// support) // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - BareMetalServerStatusReasonCodeCannotReinitializeConst = "cannot_reinitialize" - BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" - BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" - BareMetalServerStatusReasonCodeCannotUpdateFirmwareConst = "cannot_update_firmware" + ClusterNetworkSubnetReservedIPLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkSubnetReservedIPLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) -// UnmarshalBareMetalServerStatusReason unmarshals an instance of BareMetalServerStatusReason from the specified map of raw messages. -func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerStatusReason) +// UnmarshalClusterNetworkSubnetReservedIPLifecycleReason unmarshals an instance of ClusterNetworkSubnetReservedIPLifecycleReason from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReservedIPLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReservedIPLifecycleReason) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) @@ -37755,461 +42119,172 @@ func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result i return } -// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct -type BareMetalServerTrustedPlatformModule struct { - // Indicates whether the trusted platform module is enabled. - Enabled *bool `json:"enabled" validate:"required"` - - // The trusted platform module (TPM) mode: - // - `disabled`: No TPM functionality - // - `tpm_2`: TPM 2.0 - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Mode *string `json:"mode" validate:"required"` +// ClusterNetworkSubnetReservedIPPatch : ClusterNetworkSubnetReservedIPPatch struct +type ClusterNetworkSubnetReservedIPPatch struct { + // Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target` + // is deleted, or the cluster network subnet reserved IP is unbound. Must be `false` if the cluster network subnet + // reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` - // The supported trusted platform module modes. - SupportedModes []string `json:"supported_modes" validate:"required"` + // The name for this cluster network subnet reserved IP. The name must not be used by another reserved IP in the + // cluster network subnet. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` } -// Constants associated with the BareMetalServerTrustedPlatformModule.Mode property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" -) - -// Constants associated with the BareMetalServerTrustedPlatformModule.SupportedModes property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" -) - -// UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModule) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) - if err != nil { - err = core.SDKErrorf(err, "", "enabled-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) +// UnmarshalClusterNetworkSubnetReservedIPPatch unmarshals an instance of ClusterNetworkSubnetReservedIPPatch from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReservedIPPatch) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "supported_modes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerTrustedPlatformModulePatch : BareMetalServerTrustedPlatformModulePatch struct -type BareMetalServerTrustedPlatformModulePatch struct { - // The trusted platform module mode to use. The specified value must be listed in the bare metal server's - // `supported_modes`. - // - // For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the BareMetalServerTrustedPlatformModulePatch.Mode property. -// The trusted platform module mode to use. The specified value must be listed in the bare metal server's -// `supported_modes`. -// -// For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. -const ( - BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2" -) - -// UnmarshalBareMetalServerTrustedPlatformModulePatch unmarshals an instance of BareMetalServerTrustedPlatformModulePatch from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModulePatch) - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return +// AsPatch returns a generic map representation of the ClusterNetworkSubnetReservedIPPatch +func (clusterNetworkSubnetReservedIPPatch *ClusterNetworkSubnetReservedIPPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(clusterNetworkSubnetReservedIPPatch.AutoDelete) { + _patch["auto_delete"] = clusterNetworkSubnetReservedIPPatch.AutoDelete } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerTrustedPlatformModulePrototype : BareMetalServerTrustedPlatformModulePrototype struct -type BareMetalServerTrustedPlatformModulePrototype struct { - // The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's - // `supported_trusted_platform_module_modes`. - // - // If unspecified, the default trusted platform module mode from the profile will be used. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the BareMetalServerTrustedPlatformModulePrototype.Mode property. -// The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's -// `supported_trusted_platform_module_modes`. -// -// If unspecified, the default trusted platform module mode from the profile will be used. -const ( - BareMetalServerTrustedPlatformModulePrototypeModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePrototypeModeTpm2Const = "tpm_2" -) - -// UnmarshalBareMetalServerTrustedPlatformModulePrototype unmarshals an instance of BareMetalServerTrustedPlatformModulePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModulePrototype) - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return + if !core.IsNil(clusterNetworkSubnetReservedIPPatch.Name) { + _patch["name"] = clusterNetworkSubnetReservedIPPatch.Name } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingIdentity : Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique -// property. -// Models which "extend" this model: -// - CatalogOfferingIdentityCatalogOfferingByCRN -type CatalogOfferingIdentity struct { - // The CRN for this - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn,omitempty"` -} - -func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { - return true -} - -type CatalogOfferingIdentityIntf interface { - isaCatalogOfferingIdentity() bool -} -// UnmarshalCatalogOfferingIdentity unmarshals an instance of CatalogOfferingIdentity from the specified map of raw messages. -func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// CatalogOfferingVersionIdentity : Identifies a version of a -// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique property. -// Models which "extend" this model: -// - CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN -type CatalogOfferingVersionIdentity struct { - // The CRN for this version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn,omitempty"` -} +// ClusterNetworkSubnetReservedIPReference : ClusterNetworkSubnetReservedIPReference struct +type ClusterNetworkSubnetReservedIPReference struct { + // The IP address. + // + // If the address is pending allocation, the value will be `0.0.0.0`. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. + Address *string `json:"address" validate:"required"` -func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool { - return true -} + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` -type CatalogOfferingVersionIdentityIntf interface { - isaCatalogOfferingVersionIdentity() bool -} + // The URL for this cluster network subnet reserved IP. + Href *string `json:"href" validate:"required"` -// UnmarshalCatalogOfferingVersionIdentity unmarshals an instance of CatalogOfferingVersionIdentity from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The unique identifier for this cluster network subnet reserved IP. + ID *string `json:"id" validate:"required"` -// CatalogOfferingVersionPlanIdentity : Identifies a catalog offering version's billing plan by a unique property. -// Models which "extend" this model: -// - CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN -type CatalogOfferingVersionPlanIdentity struct { - // The CRN for this - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering version's billing plan. - CRN *string `json:"crn,omitempty"` -} + // The name for this cluster network subnet reserved IP. The name is unique across all reserved IPs in a cluster + // network subnet. + Name *string `json:"name" validate:"required"` -func (*CatalogOfferingVersionPlanIdentity) isaCatalogOfferingVersionPlanIdentity() bool { - return true + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -type CatalogOfferingVersionPlanIdentityIntf interface { - isaCatalogOfferingVersionPlanIdentity() bool -} +// Constants associated with the ClusterNetworkSubnetReservedIPReference.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetReservedIPReferenceResourceTypeClusterNetworkSubnetReservedIPConst = "cluster_network_subnet_reserved_ip" +) -// UnmarshalCatalogOfferingVersionPlanIdentity unmarshals an instance of CatalogOfferingVersionPlanIdentity from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionPlanIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionPlanIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalClusterNetworkSubnetReservedIPReference unmarshals an instance of ClusterNetworkSubnetReservedIPReference from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReservedIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingVersionPlanReference : CatalogOfferingVersionPlanReference struct -type CatalogOfferingVersionPlanReference struct { - // The CRN for this - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering version's billing plan. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` -} - -// UnmarshalCatalogOfferingVersionPlanReference unmarshals an instance of CatalogOfferingVersionPlanReference from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionPlanReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionPlanReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingVersionReference : CatalogOfferingVersionReference struct -type CatalogOfferingVersionReference struct { - // The CRN for this version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn" validate:"required"` -} - -// UnmarshalCatalogOfferingVersionReference unmarshals an instance of CatalogOfferingVersionReference from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CertificateInstanceIdentity : Identifies a certificate instance by a unique property. -// Models which "extend" this model: -// - CertificateInstanceIdentityByCRN -type CertificateInstanceIdentity struct { - // The CRN for this certificate instance. - CRN *string `json:"crn,omitempty"` -} - -func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { - return true -} - -type CertificateInstanceIdentityIntf interface { - isaCertificateInstanceIdentity() bool -} - -// UnmarshalCertificateInstanceIdentity unmarshals an instance of CertificateInstanceIdentity from the specified map of raw messages. -func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CertificateInstanceIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CertificateInstanceReference : CertificateInstanceReference struct -type CertificateInstanceReference struct { - // The CRN for this certificate instance. - CRN *string `json:"crn" validate:"required"` -} - -// UnmarshalCertificateInstanceReference unmarshals an instance of CertificateInstanceReference from the specified map of raw messages. -func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CertificateInstanceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// CheckVPNGatewayConnectionsLocalCIDROptions : The CheckVPNGatewayConnectionsLocalCIDR options. -type CheckVPNGatewayConnectionsLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The IP address range in CIDR block notation. - CIDR *string `json:"cidr" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCheckVPNGatewayConnectionsLocalCIDROptions : Instantiate CheckVPNGatewayConnectionsLocalCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *CheckVPNGatewayConnectionsLocalCIDROptions { - return &CheckVPNGatewayConnectionsLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDR: core.StringPtr(cidr), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionsLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDR : Allow user to set CIDR -func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayConnectionsLocalCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CheckVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsLocalCIDROptions { - options.Headers = param - return options -} - -// CheckVPNGatewayConnectionsPeerCIDROptions : The CheckVPNGatewayConnectionsPeerCIDR options. -type CheckVPNGatewayConnectionsPeerCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` - - // The IP address range in CIDR block notation. - CIDR *string `json:"cidr" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCheckVPNGatewayConnectionsPeerCIDROptions : Instantiate CheckVPNGatewayConnectionsPeerCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *CheckVPNGatewayConnectionsPeerCIDROptions { - return &CheckVPNGatewayConnectionsPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDR: core.StringPtr(cidr), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionsPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} +// ClusterNetworkSubnetReservedIPTarget : The target this cluster network subnet reserved IP is bound to. +// +// If absent, this cluster network subnet reserved IP is provider-owned or unbound. +// Models which "extend" this model: +// - ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext +type ClusterNetworkSubnetReservedIPTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` -// SetCIDR : Allow user to set CIDR -func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayConnectionsPeerCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} + // The URL for this cluster network interface. + Href *string `json:"href,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *CheckVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsPeerCIDROptions { - options.Headers = param - return options -} + // The unique identifier for this cluster network interface. + ID *string `json:"id,omitempty"` -// CloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. -// Models which "extend" this model: -// - CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName -// - CloudObjectStorageBucketIdentityByCRN -type CloudObjectStorageBucketIdentity struct { - // The globally unique name of this Cloud Object Storage bucket. + // The name for this cluster network interface. The name is unique across all interfaces in the cluster network. Name *string `json:"name,omitempty"` - // The CRN of this Cloud Object Storage bucket. - CRN *string `json:"crn,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` } -func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { +// Constants associated with the ClusterNetworkSubnetReservedIPTarget.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetReservedIPTargetResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" +) + +func (*ClusterNetworkSubnetReservedIPTarget) isaClusterNetworkSubnetReservedIPTarget() bool { return true } -type CloudObjectStorageBucketIdentityIntf interface { - isaCloudObjectStorageBucketIdentity() bool +type ClusterNetworkSubnetReservedIPTargetIntf interface { + isaClusterNetworkSubnetReservedIPTarget() bool } -// UnmarshalCloudObjectStorageBucketIdentity unmarshals an instance of CloudObjectStorageBucketIdentity from the specified map of raw messages. -func UnmarshalCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageBucketIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalClusterNetworkSubnetReservedIPTarget unmarshals an instance of ClusterNetworkSubnetReservedIPTarget from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReservedIPTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CloudObjectStorageBucketReference : CloudObjectStorageBucketReference struct -type CloudObjectStorageBucketReference struct { - // The CRN of this Cloud Object Storage bucket. - CRN *string `json:"crn" validate:"required"` - - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalCloudObjectStorageBucketReference unmarshals an instance of CloudObjectStorageBucketReference from the specified map of raw messages. -func UnmarshalCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageBucketReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -38217,22 +42292,9 @@ func UnmarshalCloudObjectStorageBucketReference(m map[string]json.RawMessage, re err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CloudObjectStorageObjectReference : CloudObjectStorageObjectReference struct -type CloudObjectStorageObjectReference struct { - // The name of this Cloud Object Storage object. Names are unique within a Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalCloudObjectStorageObjectReference unmarshals an instance of CloudObjectStorageObjectReference from the specified map of raw messages. -func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageObjectReference) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38244,7 +42306,7 @@ type CreateBackupPolicyOptions struct { // The backup policy prototype object. BackupPolicyPrototype BackupPolicyPrototypeIntf `json:"BackupPolicyPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38299,7 +42361,7 @@ type CreateBackupPolicyPlanOptions struct { // The policies for additional backups in remote regions. RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38385,7 +42447,7 @@ type CreateBareMetalServerConsoleAccessTokenOptions struct { // no effect on VNC consoles. Force *bool `json:"force,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38438,7 +42500,7 @@ type CreateBareMetalServerNetworkAttachmentOptions struct { // The bare metal server network attachment prototype object. BareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf `json:"BareMetalServerNetworkAttachmentPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38476,7 +42538,7 @@ type CreateBareMetalServerNetworkInterfaceOptions struct { // The bare metal server network interface prototype object. BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38511,7 +42573,7 @@ type CreateBareMetalServerOptions struct { // The bare metal server prototype object. BareMetalServerPrototype BareMetalServerPrototypeIntf `json:"BareMetalServerPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38534,6 +42596,318 @@ func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) return options } +// CreateClusterNetworkAttachmentOptions : The CreateClusterNetworkAttachment options. +type CreateClusterNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // A cluster network interface for the instance cluster network attachment. This can be + // specified using an existing cluster network interface that does not already have a `target`, + // or a prototype object for a new cluster network interface. + // + // This instance must reside in the same VPC as the specified cluster network interface. The + // cluster network interface must reside in the same cluster network as the + // `cluster_network_interface` of any other `cluster_network_attachments` for this instance. + ClusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf `json:"cluster_network_interface" validate:"required"` + + // The instance cluster network attachment to insert this instance cluster network attachment + // immediately before. + // + // If unspecified, this instance cluster network attachment will be inserted after all + // existing instance cluster network attachments. + Before InstanceClusterNetworkAttachmentBeforePrototypeIntf `json:"before,omitempty"` + + // The name for this cluster network attachment. Names must be unique within the instance the cluster network + // attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. Names starting + // with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCreateClusterNetworkAttachmentOptions : Instantiate CreateClusterNetworkAttachmentOptions +func (*VpcV1) NewCreateClusterNetworkAttachmentOptions(instanceID string, clusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf) *CreateClusterNetworkAttachmentOptions { + return &CreateClusterNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ClusterNetworkInterface: clusterNetworkInterface, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateClusterNetworkAttachmentOptions) SetInstanceID(instanceID string) *CreateClusterNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetClusterNetworkInterface : Allow user to set ClusterNetworkInterface +func (_options *CreateClusterNetworkAttachmentOptions) SetClusterNetworkInterface(clusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf) *CreateClusterNetworkAttachmentOptions { + _options.ClusterNetworkInterface = clusterNetworkInterface + return _options +} + +// SetBefore : Allow user to set Before +func (_options *CreateClusterNetworkAttachmentOptions) SetBefore(before InstanceClusterNetworkAttachmentBeforePrototypeIntf) *CreateClusterNetworkAttachmentOptions { + _options.Before = before + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateClusterNetworkAttachmentOptions) SetName(name string) *CreateClusterNetworkAttachmentOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateClusterNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateClusterNetworkAttachmentOptions { + options.Headers = param + return options +} + +// CreateClusterNetworkInterfaceOptions : The CreateClusterNetworkInterface options. +type CreateClusterNetworkInterfaceOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The name for this cluster network interface. The name must not be used by another interface in the cluster network. + // Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the cluster network interface. May be either + // a cluster network subnet reserved IP identity, or a cluster network subnet reserved IP + // prototype object which will be used to create a new cluster network subnet reserved IP. + // + // If a cluster network subnet reserved IP identity is provided, the specified cluster + // network subnet reserved IP must be unbound. + // + // If a cluster network subnet reserved IP prototype object with an address is provided, + // the address must be available on the cluster network interface's cluster network + // subnet. If no address is specified, an available address on the cluster network subnet + // will be automatically selected and reserved. + PrimaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The associated cluster network subnet. Required if `primary_ip` does not specify a cluster + // network subnet reserved IP identity. + Subnet ClusterNetworkSubnetIdentityIntf `json:"subnet,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCreateClusterNetworkInterfaceOptions : Instantiate CreateClusterNetworkInterfaceOptions +func (*VpcV1) NewCreateClusterNetworkInterfaceOptions(clusterNetworkID string) *CreateClusterNetworkInterfaceOptions { + return &CreateClusterNetworkInterfaceOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *CreateClusterNetworkInterfaceOptions) SetClusterNetworkID(clusterNetworkID string) *CreateClusterNetworkInterfaceOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateClusterNetworkInterfaceOptions) SetName(name string) *CreateClusterNetworkInterfaceOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPrimaryIP : Allow user to set PrimaryIP +func (_options *CreateClusterNetworkInterfaceOptions) SetPrimaryIP(primaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf) *CreateClusterNetworkInterfaceOptions { + _options.PrimaryIP = primaryIP + return _options +} + +// SetSubnet : Allow user to set Subnet +func (_options *CreateClusterNetworkInterfaceOptions) SetSubnet(subnet ClusterNetworkSubnetIdentityIntf) *CreateClusterNetworkInterfaceOptions { + _options.Subnet = subnet + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateClusterNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateClusterNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateClusterNetworkOptions : The CreateClusterNetwork options. +type CreateClusterNetworkOptions struct { + // The profile to use for this cluster network. + Profile ClusterNetworkProfileIdentityIntf `json:"profile" validate:"required"` + + // The VPC this cluster network will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The zone this cluster network will reside in. The zone must be listed + // as supported on the specified cluster network profile. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The name for this cluster network. The name must not be used by another cluster network in the region. Names + // starting with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + SubnetPrefixes []ClusterNetworkSubnetPrefixPrototype `json:"subnet_prefixes,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCreateClusterNetworkOptions : Instantiate CreateClusterNetworkOptions +func (*VpcV1) NewCreateClusterNetworkOptions(profile ClusterNetworkProfileIdentityIntf, vpc VPCIdentityIntf, zone ZoneIdentityIntf) *CreateClusterNetworkOptions { + return &CreateClusterNetworkOptions{ + Profile: profile, + VPC: vpc, + Zone: zone, + } +} + +// SetProfile : Allow user to set Profile +func (_options *CreateClusterNetworkOptions) SetProfile(profile ClusterNetworkProfileIdentityIntf) *CreateClusterNetworkOptions { + _options.Profile = profile + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateClusterNetworkOptions) SetVPC(vpc VPCIdentityIntf) *CreateClusterNetworkOptions { + _options.VPC = vpc + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateClusterNetworkOptions) SetZone(zone ZoneIdentityIntf) *CreateClusterNetworkOptions { + _options.Zone = zone + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateClusterNetworkOptions) SetName(name string) *CreateClusterNetworkOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateClusterNetworkOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateClusterNetworkOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSubnetPrefixes : Allow user to set SubnetPrefixes +func (_options *CreateClusterNetworkOptions) SetSubnetPrefixes(subnetPrefixes []ClusterNetworkSubnetPrefixPrototype) *CreateClusterNetworkOptions { + _options.SubnetPrefixes = subnetPrefixes + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateClusterNetworkOptions) SetHeaders(param map[string]string) *CreateClusterNetworkOptions { + options.Headers = param + return options +} + +// CreateClusterNetworkSubnetOptions : The CreateClusterNetworkSubnet options. +type CreateClusterNetworkSubnetOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet prototype object. + ClusterNetworkSubnetPrototype ClusterNetworkSubnetPrototypeIntf `json:"ClusterNetworkSubnetPrototype" validate:"required"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCreateClusterNetworkSubnetOptions : Instantiate CreateClusterNetworkSubnetOptions +func (*VpcV1) NewCreateClusterNetworkSubnetOptions(clusterNetworkID string, clusterNetworkSubnetPrototype ClusterNetworkSubnetPrototypeIntf) *CreateClusterNetworkSubnetOptions { + return &CreateClusterNetworkSubnetOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ClusterNetworkSubnetPrototype: clusterNetworkSubnetPrototype, + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *CreateClusterNetworkSubnetOptions) SetClusterNetworkID(clusterNetworkID string) *CreateClusterNetworkSubnetOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetClusterNetworkSubnetPrototype : Allow user to set ClusterNetworkSubnetPrototype +func (_options *CreateClusterNetworkSubnetOptions) SetClusterNetworkSubnetPrototype(clusterNetworkSubnetPrototype ClusterNetworkSubnetPrototypeIntf) *CreateClusterNetworkSubnetOptions { + _options.ClusterNetworkSubnetPrototype = clusterNetworkSubnetPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateClusterNetworkSubnetOptions) SetHeaders(param map[string]string) *CreateClusterNetworkSubnetOptions { + options.Headers = param + return options +} + +// CreateClusterNetworkSubnetReservedIPOptions : The CreateClusterNetworkSubnetReservedIP options. +type CreateClusterNetworkSubnetReservedIPOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet identifier. + ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="` + + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // The name for this cluster network subnet reserved IP. The name must not be used by another reserved IP in the + // cluster network subnet. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + // If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCreateClusterNetworkSubnetReservedIPOptions : Instantiate CreateClusterNetworkSubnetReservedIPOptions +func (*VpcV1) NewCreateClusterNetworkSubnetReservedIPOptions(clusterNetworkID string, clusterNetworkSubnetID string) *CreateClusterNetworkSubnetReservedIPOptions { + return &CreateClusterNetworkSubnetReservedIPOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *CreateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkID(clusterNetworkID string) *CreateClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID +func (_options *CreateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *CreateClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID) + return _options +} + +// SetAddress : Allow user to set Address +func (_options *CreateClusterNetworkSubnetReservedIPOptions) SetAddress(address string) *CreateClusterNetworkSubnetReservedIPOptions { + _options.Address = core.StringPtr(address) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateClusterNetworkSubnetReservedIPOptions) SetName(name string) *CreateClusterNetworkSubnetReservedIPOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateClusterNetworkSubnetReservedIPOptions) SetHeaders(param map[string]string) *CreateClusterNetworkSubnetReservedIPOptions { + options.Headers = param + return options +} + // CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. type CreateDedicatedHostGroupOptions struct { // The dedicated host profile class for hosts in this group. @@ -38553,7 +42927,7 @@ type CreateDedicatedHostGroupOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38615,7 +42989,7 @@ type CreateDedicatedHostOptions struct { // The dedicated host prototype object. DedicatedHostPrototype DedicatedHostPrototypeIntf `json:"DedicatedHostPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38670,7 +43044,7 @@ type CreateEndpointGatewayOptions struct { // The security groups to use for this endpoint gateway. If unspecified, the VPC's default security group is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38735,7 +43109,7 @@ type CreateFloatingIPOptions struct { // The floating IP prototype object. FloatingIPPrototype FloatingIPPrototypeIntf `json:"FloatingIPPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38788,7 +43162,7 @@ type CreateFlowLogCollectorOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38861,7 +43235,7 @@ type CreateIkePolicyOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -38960,7 +43334,7 @@ type CreateImageExportJobOptions struct { // name. The object name will be unique within the bucket. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39014,7 +43388,7 @@ type CreateImageOptions struct { // The image prototype object. ImagePrototype ImagePrototypeIntf `json:"ImagePrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39048,7 +43422,7 @@ type CreateInstanceActionOptions struct { // If set to true, the action will be forced immediately, and all queued actions deleted. Ignored for the start action. Force *bool `json:"force,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39104,7 +43478,7 @@ type CreateInstanceConsoleAccessTokenOptions struct { // no effect on VNC consoles. Force *bool `json:"force,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39158,7 +43532,7 @@ type CreateInstanceGroupManagerActionOptions struct { // The instance group manager action prototype object. InstanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf `json:"InstanceGroupManagerActionPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39203,7 +43577,7 @@ type CreateInstanceGroupManagerOptions struct { // The instance group manager prototype object. InstanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf `json:"InstanceGroupManagerPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39244,7 +43618,7 @@ type CreateInstanceGroupManagerPolicyOptions struct { // The instance group manager policy prototype object. InstanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf `json:"InstanceGroupManagerPolicyPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39325,7 +43699,7 @@ type CreateInstanceGroupOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39408,7 +43782,7 @@ type CreateInstanceNetworkAttachmentOptions struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39476,7 +43850,7 @@ type CreateInstanceNetworkInterfaceOptions struct { // used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39535,7 +43909,7 @@ type CreateInstanceOptions struct { // The instance prototype object. InstancePrototype InstancePrototypeIntf `json:"InstancePrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39563,7 +43937,7 @@ type CreateInstanceTemplateOptions struct { // The instance template prototype object. InstanceTemplatePrototype InstanceTemplatePrototypeIntf `json:"InstanceTemplatePrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39601,7 +43975,7 @@ type CreateInstanceVolumeAttachmentOptions struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39677,7 +44051,7 @@ type CreateIpsecPolicyOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39803,7 +44177,7 @@ type CreateKeyOptions struct { // The crypto-system for this key. Type *string `json:"type,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -39881,7 +44255,9 @@ type CreateLoadBalancerListenerOptions struct { // `protocol` of `https`. CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - // The connection limit of the listener. + // The concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected. + // + // This property will be present for load balancers in the `application` family. ConnectionLimit *int64 `json:"connection_limit,omitempty"` // The default pool for this listener. If `https_redirect` is specified, the @@ -39904,7 +44280,9 @@ type CreateLoadBalancerListenerOptions struct { // listener must have a `protocol` of `https`. HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` - // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. + // The idle connection timeout of the listener in seconds. + // + // Supported for load balancers in the `application` family. IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` // The policy prototype objects for this listener. The load balancer must be in the @@ -39937,7 +44315,7 @@ type CreateLoadBalancerListenerOptions struct { // same protocol. PortMin *int64 `json:"port_min,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40056,9 +44434,9 @@ type CreateLoadBalancerListenerPolicyOptions struct { // The policy action: // - `forward`: Requests will be forwarded to the specified `target` pool - // - `https_redirect`: Requests will be redirected to the specified target listener. The - // listener must have a `protocol` of `http`, and the target listener must have a - // `protocol` of `https` + // - `https_redirect`: Requests will be redirected to the specified `target.listener`. + // This listener must have a `protocol` of `http`, and the target listener must + // have a `protocol` of `https`. // - `redirect`: Requests will be redirected to the specified `target.url` // - `reject`: Requests will be rejected with a `403` status code. Action *string `json:"action" validate:"required"` @@ -40074,22 +44452,25 @@ type CreateLoadBalancerListenerPolicyOptions struct { // The rule prototype objects for this policy. Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` - // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. + // - If `action` is `forward`, use `LoadBalancerPoolIdentity` to specify a pool in this + // load balancer to forward to. + // - If `action` is `https_redirect`, use + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener on this + // load balancer to redirect to. + // - If `action` is `redirect`, use `LoadBalancerListenerPolicyRedirectURLPrototype`to + // specify a URL to redirect to. Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } // Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. // The policy action: // - `forward`: Requests will be forwarded to the specified `target` pool -// - `https_redirect`: Requests will be redirected to the specified target listener. The -// listener must have a `protocol` of `http`, and the target listener must have a -// `protocol` of `https` +// - `https_redirect`: Requests will be redirected to the specified `target.listener`. +// This listener must have a `protocol` of `http`, and the target listener must +// have a `protocol` of `https`. // - `redirect`: Requests will be redirected to the specified `target.url` // - `reject`: Requests will be rejected with a `403` status code. const ( @@ -40187,7 +44568,7 @@ type CreateLoadBalancerListenerPolicyRuleOptions struct { // If the rule condition is not `matches_regex`, the value must be percent-encoded. Field *string `json:"field,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40336,7 +44717,7 @@ type CreateLoadBalancerOptions struct { // The load balancer profile must support security groups. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40455,7 +44836,7 @@ type CreateLoadBalancerPoolMemberOptions struct { // If specified, the pool algorithm must be `weighted_round_robin`. Weight *int64 `json:"weight,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40544,7 +44925,7 @@ type CreateLoadBalancerPoolOptions struct { // across backend server members of the pool. SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40650,7 +45031,7 @@ type CreateNetworkACLOptions struct { // The network ACL prototype object. NetworkACLPrototype NetworkACLPrototypeIntf `json:"NetworkACLPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40681,7 +45062,7 @@ type CreateNetworkACLRuleOptions struct { // The network ACL rule prototype object. NetworkACLRulePrototype NetworkACLRulePrototypeIntf `json:"NetworkACLRulePrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40726,7 +45107,7 @@ type CreatePlacementGroupOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40793,7 +45174,7 @@ type CreatePrivatePathServiceGatewayAccountPolicyOptions struct { // policies for this private path service gateway. Account AccountIdentityIntf `json:"account" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40880,7 +45261,7 @@ type CreatePrivatePathServiceGatewayOptions struct { // in the region the service resides in. ZonalAffinity *bool `json:"zonal_affinity,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -40960,7 +45341,7 @@ type CreatePublicGatewayOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41035,7 +45416,7 @@ type CreateReservationOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41121,7 +45502,7 @@ type CreateSecurityGroupOptions struct { // resulting in all traffic being denied. Rules []SecurityGroupRulePrototypeIntf `json:"rules,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41170,7 +45551,7 @@ type CreateSecurityGroupRuleOptions struct { // The properties of the security group rule to be created. SecurityGroupRulePrototype SecurityGroupRulePrototypeIntf `json:"SecurityGroupRulePrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41208,7 +45589,7 @@ type CreateSecurityGroupTargetBindingOptions struct { // The security group target identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41246,7 +45627,7 @@ type CreateShareMountTargetOptions struct { // The share mount target prototype object. ShareMountTargetPrototype ShareMountTargetPrototypeIntf `json:"ShareMountTargetPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41281,7 +45662,7 @@ type CreateShareOptions struct { // The file share prototype object. SharePrototype SharePrototypeIntf `json:"SharePrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41312,7 +45693,7 @@ type CreateSnapshotCloneOptions struct { // The zone name. ZoneName *string `json:"zone_name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41347,7 +45728,7 @@ type CreateSnapshotConsistencyGroupOptions struct { // The snapshot consistency group prototype object. SnapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf `json:"SnapshotConsistencyGroupPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41375,7 +45756,7 @@ type CreateSnapshotOptions struct { // The snapshot prototype object. SnapshotPrototype SnapshotPrototypeIntf `json:"SnapshotPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41403,7 +45784,7 @@ type CreateSubnetOptions struct { // The subnet prototype object. SubnetPrototype SubnetPrototypeIntf `json:"SubnetPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41454,7 +45835,7 @@ type CreateSubnetReservedIPOptions struct { // If unspecified, the reserved IP will be created unbound. Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41575,7 +45956,7 @@ type CreateVirtualNetworkInterfaceOptions struct { // identity. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41673,7 +46054,7 @@ type CreateVolumeOptions struct { // The volume prototype object. VolumePrototype VolumePrototypeIntf `json:"VolumePrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41724,7 +46105,7 @@ type CreateVPCAddressPrefixOptions struct { // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41790,7 +46171,7 @@ type CreateVPCDnsResolutionBindingOptions struct { // If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41839,6 +46220,11 @@ type CreateVPCOptions struct { // Indicates whether this VPC will be connected to Classic Infrastructure. If true, this VPC's resources will have // private network connectivity to the account's Classic Infrastructure resources. Only one VPC, per region, may be // connected in this way. This value is set at creation and subsequently immutable. + // + // This property has been deprecated. Instead, use a [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to + // connect this VPC to Classic Infrastructure. For more information, see [upcoming + // changes](https://cloud.ibm.com/docs/vpc?topic=vpc-api-change-log#upcoming-changes). + // Deprecated: this field is deprecated and may be removed in a future release. ClassicAccess *bool `json:"classic_access,omitempty"` // The DNS configuration for this VPC. @@ -41855,7 +46241,7 @@ type CreateVPCOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -41883,6 +46269,7 @@ func (_options *CreateVPCOptions) SetAddressPrefixManagement(addressPrefixManage } // SetClassicAccess : Allow user to set ClassicAccess +// Deprecated: this method is deprecated and may be removed in a future release. func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVPCOptions { _options.ClassicAccess = core.BoolPtr(classicAccess) return _options @@ -41965,7 +46352,7 @@ type CreateVPCRouteOptions struct { // distributed between them. Priority *int64 `json:"priority,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -42051,6 +46438,8 @@ type CreateVPCRoutingTableOptions struct { VPCID *string `json:"vpc_id" validate:"required,ne="` // The filters specifying the resources that may create routes in this routing table. + // + // If specified, `resource_type` must be `vpn_gateway` or `vpn_server`. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these @@ -42110,7 +46499,7 @@ type CreateVPCRoutingTableOptions struct { // with no routes. Routes []RoutePrototype `json:"routes,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -42247,7 +46636,7 @@ type CreateVPCRoutingTableRouteOptions struct { // distributed between them. Priority *int64 `json:"priority,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -42342,7 +46731,7 @@ type CreateVPNGatewayConnectionOptions struct { // The VPN gateway connection prototype object. VPNGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf `json:"VPNGatewayConnectionPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -42377,7 +46766,7 @@ type CreateVPNGatewayOptions struct { // The VPN gateway prototype object. VPNGatewayPrototype VPNGatewayPrototypeIntf `json:"VPNGatewayPrototype" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -42452,7 +46841,7 @@ type CreateVPNServerOptions struct { // The security groups to use for this VPN server. If unspecified, the VPC's default security group is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -42571,7 +46960,7 @@ type CreateVPNServerRouteOptions struct { // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -42639,6 +47028,7 @@ func (*DnsInstanceIdentity) isaDnsInstanceIdentity() bool { type DnsInstanceIdentityIntf interface { isaDnsInstanceIdentity() bool + asPatch() map[string]interface{} } // UnmarshalDnsInstanceIdentity unmarshals an instance of DnsInstanceIdentity from the specified map of raw messages. @@ -42653,6 +47043,16 @@ func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface return } +// asPatch returns a generic map representation of the DnsInstanceIdentity +func (dnsInstanceIdentity *DnsInstanceIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(dnsInstanceIdentity.CRN) { + _patch["crn"] = dnsInstanceIdentity.CRN + } + + return +} + // DnsInstanceReferenceLoadBalancerDnsContext : DnsInstanceReferenceLoadBalancerDnsContext struct type DnsInstanceReferenceLoadBalancerDnsContext struct { // The CRN for this DNS instance. @@ -42726,6 +47126,19 @@ func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{ return } +// asPatch returns a generic map representation of the DnsServerPrototype +func (dnsServerPrototype *DnsServerPrototype) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(dnsServerPrototype.Address) { + _patch["address"] = dnsServerPrototype.Address + } + if !core.IsNil(dnsServerPrototype.ZoneAffinity) { + _patch["zone_affinity"] = dnsServerPrototype.ZoneAffinity.asPatch() + } + + return +} + // DnsZoneIdentity : Identifies a DNS zone by a unique property. // Models which "extend" this model: // - DnsZoneIdentityByID @@ -42739,6 +47152,7 @@ func (*DnsZoneIdentity) isaDnsZoneIdentity() bool { type DnsZoneIdentityIntf interface { isaDnsZoneIdentity() bool + asPatch() map[string]interface{} } // UnmarshalDnsZoneIdentity unmarshals an instance of DnsZoneIdentity from the specified map of raw messages. @@ -42753,6 +47167,16 @@ func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) return } +// asPatch returns a generic map representation of the DnsZoneIdentity +func (dnsZoneIdentity *DnsZoneIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(dnsZoneIdentity.ID) { + _patch["id"] = dnsZoneIdentity.ID + } + + return +} + // DnsZoneReference : DnsZoneReference struct type DnsZoneReference struct { ID *string `json:"id" validate:"required"` @@ -43004,14 +47428,14 @@ type DedicatedHostCollection struct { DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"` // A link to the first page of resources. - First *DedicatedHostCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *DedicatedHostCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -43025,7 +47449,7 @@ func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -43035,7 +47459,7 @@ func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -43064,42 +47488,6 @@ func (resp *DedicatedHostCollection) GetNextStart() (*string, error) { return start, nil } -// DedicatedHostCollectionFirst : A link to the first page of resources. -type DedicatedHostCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostCollectionFirst unmarshals an instance of DedicatedHostCollectionFirst from the specified map of raw messages. -func UnmarshalDedicatedHostCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type DedicatedHostCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostCollectionNext unmarshals an instance of DedicatedHostCollectionNext from the specified map of raw messages. -func UnmarshalDedicatedHostCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // DedicatedHostDisk : DedicatedHostDisk struct type DedicatedHostDisk struct { // The remaining space left for instance placement in GB (gigabytes). @@ -43281,14 +47669,11 @@ func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interf // AsPatch returns a generic map representation of the DedicatedHostDiskPatch func (dedicatedHostDiskPatch *DedicatedHostDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(dedicatedHostDiskPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(dedicatedHostDiskPatch.Name) { + _patch["name"] = dedicatedHostDiskPatch.Name } + return } @@ -43415,7 +47800,7 @@ func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{ // DedicatedHostGroupCollection : DedicatedHostGroupCollection struct type DedicatedHostGroupCollection struct { // A link to the first page of resources. - First *DedicatedHostGroupCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of dedicated host groups. Groups []DedicatedHostGroup `json:"groups" validate:"required"` @@ -43425,7 +47810,7 @@ type DedicatedHostGroupCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *DedicatedHostGroupCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -43434,7 +47819,7 @@ type DedicatedHostGroupCollection struct { // UnmarshalDedicatedHostGroupCollection unmarshals an instance of DedicatedHostGroupCollection from the specified map of raw messages. func UnmarshalDedicatedHostGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(DedicatedHostGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostGroupCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -43449,7 +47834,7 @@ func UnmarshalDedicatedHostGroupCollection(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostGroupCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -43478,42 +47863,6 @@ func (resp *DedicatedHostGroupCollection) GetNextStart() (*string, error) { return start, nil } -// DedicatedHostGroupCollectionFirst : A link to the first page of resources. -type DedicatedHostGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostGroupCollectionFirst unmarshals an instance of DedicatedHostGroupCollectionFirst from the specified map of raw messages. -func UnmarshalDedicatedHostGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type DedicatedHostGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostGroupCollectionNext unmarshals an instance of DedicatedHostGroupCollectionNext from the specified map of raw messages. -func UnmarshalDedicatedHostGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // DedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. // Models which "extend" this model: // - DedicatedHostGroupIdentityByID @@ -43580,14 +47929,11 @@ func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result inter // AsPatch returns a generic map representation of the DedicatedHostGroupPatch func (dedicatedHostGroupPatch *DedicatedHostGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(dedicatedHostGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(dedicatedHostGroupPatch.Name) { + _patch["name"] = dedicatedHostGroupPatch.Name } + return } @@ -43763,14 +48109,14 @@ func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{ // AsPatch returns a generic map representation of the DedicatedHostPatch func (dedicatedHostPatch *DedicatedHostPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(dedicatedHostPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(dedicatedHostPatch.InstancePlacementEnabled) { + _patch["instance_placement_enabled"] = dedicatedHostPatch.InstancePlacementEnabled } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(dedicatedHostPatch.Name) { + _patch["name"] = dedicatedHostPatch.Name } + return } @@ -43919,14 +48265,14 @@ func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interfac // DedicatedHostProfileCollection : DedicatedHostProfileCollection struct type DedicatedHostProfileCollection struct { // A link to the first page of resources. - First *DedicatedHostProfileCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *DedicatedHostProfileCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of dedicated host profiles. Profiles []DedicatedHostProfile `json:"profiles" validate:"required"` @@ -43938,7 +48284,7 @@ type DedicatedHostProfileCollection struct { // UnmarshalDedicatedHostProfileCollection unmarshals an instance of DedicatedHostProfileCollection from the specified map of raw messages. func UnmarshalDedicatedHostProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(DedicatedHostProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostProfileCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -43948,7 +48294,7 @@ func UnmarshalDedicatedHostProfileCollection(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostProfileCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -43982,42 +48328,6 @@ func (resp *DedicatedHostProfileCollection) GetNextStart() (*string, error) { return start, nil } -// DedicatedHostProfileCollectionFirst : A link to the first page of resources. -type DedicatedHostProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostProfileCollectionFirst unmarshals an instance of DedicatedHostProfileCollectionFirst from the specified map of raw messages. -func UnmarshalDedicatedHostProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type DedicatedHostProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalDedicatedHostProfileCollectionNext unmarshals an instance of DedicatedHostProfileCollectionNext from the specified map of raw messages. -func UnmarshalDedicatedHostProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // DedicatedHostProfileDisk : Disks provided by this profile. type DedicatedHostProfileDisk struct { InterfaceType *DedicatedHostProfileDiskInterface `json:"interface_type" validate:"required"` @@ -44816,8 +49126,8 @@ func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{} type DefaultRoutingTable struct { // The filters specifying the resources that may create routes in this routing table. // - // At present, only the `resource_type` filter is permitted, and only the values - // `vpn_gateway` and `vpn_server` are supported, but filter support is expected to expand in the future. + // The resources and types of filters supported by this property is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these @@ -45114,7 +49424,7 @@ type DeleteBackupPolicyOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45154,7 +49464,7 @@ type DeleteBackupPolicyPlanOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45198,7 +49508,7 @@ type DeleteBareMetalServerNetworkAttachmentOptions struct { // The bare metal server network attachment identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45236,7 +49546,7 @@ type DeleteBareMetalServerNetworkInterfaceOptions struct { // The bare metal server network interface identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45271,7 +49581,7 @@ type DeleteBareMetalServerOptions struct { // The bare metal server identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45294,12 +49604,200 @@ func (options *DeleteBareMetalServerOptions) SetHeaders(param map[string]string) return options } +// DeleteClusterNetworkInterfaceOptions : The DeleteClusterNetworkInterface options. +type DeleteClusterNetworkInterfaceOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewDeleteClusterNetworkInterfaceOptions : Instantiate DeleteClusterNetworkInterfaceOptions +func (*VpcV1) NewDeleteClusterNetworkInterfaceOptions(clusterNetworkID string, id string) *DeleteClusterNetworkInterfaceOptions { + return &DeleteClusterNetworkInterfaceOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ID: core.StringPtr(id), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *DeleteClusterNetworkInterfaceOptions) SetClusterNetworkID(clusterNetworkID string) *DeleteClusterNetworkInterfaceOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteClusterNetworkInterfaceOptions) SetID(id string) *DeleteClusterNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteClusterNetworkInterfaceOptions) SetIfMatch(ifMatch string) *DeleteClusterNetworkInterfaceOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteClusterNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteClusterNetworkInterfaceOptions { + options.Headers = param + return options +} + +// DeleteClusterNetworkOptions : The DeleteClusterNetwork options. +type DeleteClusterNetworkOptions struct { + // The cluster network identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewDeleteClusterNetworkOptions : Instantiate DeleteClusterNetworkOptions +func (*VpcV1) NewDeleteClusterNetworkOptions(id string) *DeleteClusterNetworkOptions { + return &DeleteClusterNetworkOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteClusterNetworkOptions) SetID(id string) *DeleteClusterNetworkOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteClusterNetworkOptions) SetIfMatch(ifMatch string) *DeleteClusterNetworkOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteClusterNetworkOptions) SetHeaders(param map[string]string) *DeleteClusterNetworkOptions { + options.Headers = param + return options +} + +// DeleteClusterNetworkSubnetOptions : The DeleteClusterNetworkSubnet options. +type DeleteClusterNetworkSubnetOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewDeleteClusterNetworkSubnetOptions : Instantiate DeleteClusterNetworkSubnetOptions +func (*VpcV1) NewDeleteClusterNetworkSubnetOptions(clusterNetworkID string, id string) *DeleteClusterNetworkSubnetOptions { + return &DeleteClusterNetworkSubnetOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ID: core.StringPtr(id), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *DeleteClusterNetworkSubnetOptions) SetClusterNetworkID(clusterNetworkID string) *DeleteClusterNetworkSubnetOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteClusterNetworkSubnetOptions) SetID(id string) *DeleteClusterNetworkSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteClusterNetworkSubnetOptions) SetIfMatch(ifMatch string) *DeleteClusterNetworkSubnetOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteClusterNetworkSubnetOptions) SetHeaders(param map[string]string) *DeleteClusterNetworkSubnetOptions { + options.Headers = param + return options +} + +// DeleteClusterNetworkSubnetReservedIPOptions : The DeleteClusterNetworkSubnetReservedIP options. +type DeleteClusterNetworkSubnetReservedIPOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet identifier. + ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="` + + // The cluster network subnet reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewDeleteClusterNetworkSubnetReservedIPOptions : Instantiate DeleteClusterNetworkSubnetReservedIPOptions +func (*VpcV1) NewDeleteClusterNetworkSubnetReservedIPOptions(clusterNetworkID string, clusterNetworkSubnetID string, id string) *DeleteClusterNetworkSubnetReservedIPOptions { + return &DeleteClusterNetworkSubnetReservedIPOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID), + ID: core.StringPtr(id), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *DeleteClusterNetworkSubnetReservedIPOptions) SetClusterNetworkID(clusterNetworkID string) *DeleteClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID +func (_options *DeleteClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *DeleteClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteClusterNetworkSubnetReservedIPOptions) SetID(id string) *DeleteClusterNetworkSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteClusterNetworkSubnetReservedIPOptions) SetIfMatch(ifMatch string) *DeleteClusterNetworkSubnetReservedIPOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteClusterNetworkSubnetReservedIPOptions) SetHeaders(param map[string]string) *DeleteClusterNetworkSubnetReservedIPOptions { + options.Headers = param + return options +} + // DeleteDedicatedHostGroupOptions : The DeleteDedicatedHostGroup options. type DeleteDedicatedHostGroupOptions struct { // The dedicated host group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45327,7 +49825,7 @@ type DeleteDedicatedHostOptions struct { // The dedicated host identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45355,7 +49853,7 @@ type DeleteEndpointGatewayOptions struct { // The endpoint gateway identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45383,7 +49881,7 @@ type DeleteFloatingIPOptions struct { // The floating IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45411,7 +49909,7 @@ type DeleteFlowLogCollectorOptions struct { // The flow log collector identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45439,7 +49937,7 @@ type DeleteIkePolicyOptions struct { // The IKE policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45470,7 +49968,7 @@ type DeleteImageExportJobOptions struct { // The image export job identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45505,7 +50003,7 @@ type DeleteImageOptions struct { // The image identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45528,12 +50026,50 @@ func (options *DeleteImageOptions) SetHeaders(param map[string]string) *DeleteIm return options } +// DeleteInstanceClusterNetworkAttachmentOptions : The DeleteInstanceClusterNetworkAttachment options. +type DeleteInstanceClusterNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance cluster network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewDeleteInstanceClusterNetworkAttachmentOptions : Instantiate DeleteInstanceClusterNetworkAttachmentOptions +func (*VpcV1) NewDeleteInstanceClusterNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceClusterNetworkAttachmentOptions { + return &DeleteInstanceClusterNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceClusterNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceClusterNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceClusterNetworkAttachmentOptions) SetID(id string) *DeleteInstanceClusterNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceClusterNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceClusterNetworkAttachmentOptions { + options.Headers = param + return options +} + // DeleteInstanceGroupLoadBalancerOptions : The DeleteInstanceGroupLoadBalancer options. type DeleteInstanceGroupLoadBalancerOptions struct { // The instance group identifier. InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45567,7 +50103,7 @@ type DeleteInstanceGroupManagerActionOptions struct { // The instance group manager action identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45612,7 +50148,7 @@ type DeleteInstanceGroupManagerOptions struct { // The instance group manager identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45653,7 +50189,7 @@ type DeleteInstanceGroupManagerPolicyOptions struct { // The instance group manager policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45698,7 +50234,7 @@ type DeleteInstanceGroupMembershipOptions struct { // The instance group membership identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45733,7 +50269,7 @@ type DeleteInstanceGroupMembershipsOptions struct { // The instance group identifier. InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45761,7 +50297,7 @@ type DeleteInstanceGroupOptions struct { // The instance group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45792,7 +50328,7 @@ type DeleteInstanceNetworkAttachmentOptions struct { // The instance network attachment identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45830,7 +50366,7 @@ type DeleteInstanceNetworkInterfaceOptions struct { // The instance network interface identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45868,7 +50404,7 @@ type DeleteInstanceOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45902,7 +50438,7 @@ type DeleteInstanceTemplateOptions struct { // The instance template identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45933,7 +50469,7 @@ type DeleteInstanceVolumeAttachmentOptions struct { // The volume attachment identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45968,7 +50504,7 @@ type DeleteIpsecPolicyOptions struct { // The IPsec policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -45996,7 +50532,7 @@ type DeleteKeyOptions struct { // The key identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46027,7 +50563,7 @@ type DeleteLoadBalancerListenerOptions struct { // The listener identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46068,7 +50604,7 @@ type DeleteLoadBalancerListenerPolicyOptions struct { // The policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46119,7 +50655,7 @@ type DeleteLoadBalancerListenerPolicyRuleOptions struct { // The rule identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46171,7 +50707,7 @@ type DeleteLoadBalancerOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46211,7 +50747,7 @@ type DeleteLoadBalancerPoolMemberOptions struct { // The member identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46256,7 +50792,7 @@ type DeleteLoadBalancerPoolOptions struct { // The pool identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46291,7 +50827,7 @@ type DeleteNetworkACLOptions struct { // The network ACL identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46322,7 +50858,7 @@ type DeleteNetworkACLRuleOptions struct { // The rule identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46357,7 +50893,7 @@ type DeletePlacementGroupOptions struct { // The placement group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46388,7 +50924,7 @@ type DeletePrivatePathServiceGatewayAccountPolicyOptions struct { // The account policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46423,7 +50959,7 @@ type DeletePrivatePathServiceGatewayOptions struct { // The private path service gateway identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46451,7 +50987,7 @@ type DeletePublicGatewayOptions struct { // The public gateway identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46479,7 +51015,7 @@ type DeleteReservationOptions struct { // The reservation identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46507,7 +51043,7 @@ type DeleteSecurityGroupOptions struct { // The security group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46538,7 +51074,7 @@ type DeleteSecurityGroupRuleOptions struct { // The rule identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46576,7 +51112,7 @@ type DeleteSecurityGroupTargetBindingOptions struct { // The security group target identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46614,7 +51150,7 @@ type DeleteShareAccessorBindingOptions struct { // The file share accessor binding identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46652,7 +51188,7 @@ type DeleteShareMountTargetOptions struct { // The file share mount target identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46690,7 +51226,7 @@ type DeleteShareOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46724,7 +51260,7 @@ type DeleteShareSourceOptions struct { // The file share identifier. ShareID *string `json:"share_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46755,7 +51291,7 @@ type DeleteSnapshotCloneOptions struct { // The zone name. ZoneName *string `json:"zone_name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46790,7 +51326,7 @@ type DeleteSnapshotConsistencyGroupOptions struct { // The snapshot consistency group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46821,7 +51357,7 @@ type DeleteSnapshotOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46855,7 +51391,7 @@ type DeleteSnapshotsOptions struct { // Filters the collection to resources with a `source_volume.id` property matching the specified identifier. SourceVolumeID *string `json:"source_volume.id" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46883,7 +51419,7 @@ type DeleteSubnetOptions struct { // The subnet identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46914,7 +51450,7 @@ type DeleteSubnetReservedIPOptions struct { // The reserved IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46949,7 +51485,7 @@ type DeleteVirtualNetworkInterfacesOptions struct { // The virtual network interface identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -46980,7 +51516,7 @@ type DeleteVolumeOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47017,7 +51553,7 @@ type DeleteVPCAddressPrefixOptions struct { // The prefix identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47055,7 +51591,7 @@ type DeleteVPCDnsResolutionBindingOptions struct { // The DNS resolution binding identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47093,7 +51629,7 @@ type DeleteVPCOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47130,7 +51666,7 @@ type DeleteVPCRouteOptions struct { // The route identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47171,7 +51707,7 @@ type DeleteVPCRoutingTableOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47218,7 +51754,7 @@ type DeleteVPCRoutingTableRouteOptions struct { // The VPC routing table route identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47263,7 +51799,7 @@ type DeleteVPNGatewayConnectionOptions struct { // The VPN gateway connection identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47298,7 +51834,7 @@ type DeleteVPNGatewayOptions struct { // The VPN gateway identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47329,7 +51865,7 @@ type DeleteVPNServerClientOptions struct { // The VPN client identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47367,7 +51903,7 @@ type DeleteVPNServerOptions struct { // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47404,7 +51940,7 @@ type DeleteVPNServerRouteOptions struct { // The VPN route identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47474,7 +52010,7 @@ type DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions struct { // - All `pending` endpoint gateway bindings for the account will remain `pending`. SetAccountPolicy *bool `json:"set_account_policy,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47515,7 +52051,7 @@ type DeprecateImageOptions struct { // The image identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47546,7 +52082,7 @@ type DisconnectVPNClientOptions struct { // The VPN client identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -47592,6 +52128,7 @@ func (*EncryptionKeyIdentity) isaEncryptionKeyIdentity() bool { type EncryptionKeyIdentityIntf interface { isaEncryptionKeyIdentity() bool + asPatch() map[string]interface{} } // UnmarshalEncryptionKeyIdentity unmarshals an instance of EncryptionKeyIdentity from the specified map of raw messages. @@ -47606,6 +52143,16 @@ func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interfa return } +// asPatch returns a generic map representation of the EncryptionKeyIdentity +func (encryptionKeyIdentity *EncryptionKeyIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(encryptionKeyIdentity.CRN) { + _patch["crn"] = encryptionKeyIdentity.CRN + } + + return +} + // EncryptionKeyReference : EncryptionKeyReference struct type EncryptionKeyReference struct { // The CRN of the [Key Protect Root @@ -47819,14 +52366,14 @@ type EndpointGatewayCollection struct { EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"` // A link to the first page of resources. - First *EndpointGatewayCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *EndpointGatewayCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -47840,7 +52387,7 @@ func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -47850,7 +52397,7 @@ func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalEndpointGatewayCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -47879,42 +52426,6 @@ func (resp *EndpointGatewayCollection) GetNextStart() (*string, error) { return start, nil } -// EndpointGatewayCollectionFirst : A link to the first page of resources. -type EndpointGatewayCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalEndpointGatewayCollectionFirst unmarshals an instance of EndpointGatewayCollectionFirst from the specified map of raw messages. -func UnmarshalEndpointGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type EndpointGatewayCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalEndpointGatewayCollectionNext unmarshals an instance of EndpointGatewayCollectionNext from the specified map of raw messages. -func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // EndpointGatewayLifecycleReason : EndpointGatewayLifecycleReason struct type EndpointGatewayLifecycleReason struct { // A reason code for this lifecycle state: @@ -48012,14 +52523,14 @@ func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interfac // AsPatch returns a generic map representation of the EndpointGatewayPatch func (endpointGatewayPatch *EndpointGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(endpointGatewayPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(endpointGatewayPatch.AllowDnsResolutionBinding) { + _patch["allow_dns_resolution_binding"] = endpointGatewayPatch.AllowDnsResolutionBinding } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(endpointGatewayPatch.Name) { + _patch["name"] = endpointGatewayPatch.Name } + return } @@ -48199,6 +52710,9 @@ func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result int // - EndpointGatewayTargetProviderCloudServiceReference // - EndpointGatewayTargetProviderInfrastructureServiceReference type EndpointGatewayTarget struct { + // The target resource type for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + // The CRN for this private path service gateway. CRN *string `json:"crn,omitempty"` @@ -48219,15 +52733,14 @@ type EndpointGatewayTarget struct { // If present, this property indicates that the resource associated with this reference // is remote and therefore may not be directly retrievable. Remote *PrivatePathServiceGatewayRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` } // Constants associated with the EndpointGatewayTarget.ResourceType property. -// The resource type. +// The target resource type for this endpoint gateway. const ( - EndpointGatewayTargetResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" + EndpointGatewayTargetResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" + EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" ) func (*EndpointGatewayTarget) isaEndpointGatewayTarget() bool { @@ -48241,6 +52754,11 @@ type EndpointGatewayTargetIntf interface { // UnmarshalEndpointGatewayTarget unmarshals an instance of EndpointGatewayTarget from the specified map of raw messages. func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(EndpointGatewayTarget) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) @@ -48271,11 +52789,6 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -48287,11 +52800,11 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa // // Models which "extend" this model: // - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype -// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype // - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype +// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype type EndpointGatewayTargetPrototype struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` + // The target resource type for this endpoint gateway. + ResourceType *string `json:"resource_type,omitempty"` // The CRN for this private path service gateway. CRN *string `json:"crn,omitempty"` @@ -48302,7 +52815,7 @@ type EndpointGatewayTargetPrototype struct { } // Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. -// The type of target for this endpoint gateway. +// The target resource type for this endpoint gateway. const ( EndpointGatewayTargetPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" @@ -48357,7 +52870,7 @@ type FailoverShareOptions struct { // If the timeout is reached, the `fallback_policy` will be triggered. Timeout *int64 `json:"timeout,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -48512,7 +53025,7 @@ func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err // FloatingIPCollection : FloatingIPCollection struct type FloatingIPCollection struct { // A link to the first page of resources. - First *FloatingIPCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of floating IPs. FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` @@ -48522,7 +53035,7 @@ type FloatingIPCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *FloatingIPCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -48531,7 +53044,7 @@ type FloatingIPCollection struct { // UnmarshalFloatingIPCollection unmarshals an instance of FloatingIPCollection from the specified map of raw messages. func UnmarshalFloatingIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FloatingIPCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -48546,7 +53059,7 @@ func UnmarshalFloatingIPCollection(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -48575,46 +53088,10 @@ func (resp *FloatingIPCollection) GetNextStart() (*string, error) { return start, nil } -// FloatingIPCollectionFirst : A link to the first page of resources. -type FloatingIPCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFloatingIPCollectionFirst unmarshals an instance of FloatingIPCollectionFirst from the specified map of raw messages. -func UnmarshalFloatingIPCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type FloatingIPCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFloatingIPCollectionNext unmarshals an instance of FloatingIPCollectionNext from the specified map of raw messages. -func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // FloatingIPCollectionVirtualNetworkInterfaceContext : FloatingIPCollectionVirtualNetworkInterfaceContext struct type FloatingIPCollectionVirtualNetworkInterfaceContext struct { // A link to the first page of resources. - First *FloatingIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of floating IPs bound to the virtual network interface specified by the identifier in the URL. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` @@ -48624,7 +53101,7 @@ type FloatingIPCollectionVirtualNetworkInterfaceContext struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *FloatingIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -48633,7 +53110,7 @@ type FloatingIPCollectionVirtualNetworkInterfaceContext struct { // UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages. func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FloatingIPCollectionVirtualNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -48648,7 +53125,7 @@ func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext(m map[string]js err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -48677,42 +53154,6 @@ func (resp *FloatingIPCollectionVirtualNetworkInterfaceContext) GetNextStart() ( return start, nil } -// FloatingIPCollectionVirtualNetworkInterfaceContextFirst : A link to the first page of resources. -type FloatingIPCollectionVirtualNetworkInterfaceContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionVirtualNetworkInterfaceContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPCollectionVirtualNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type FloatingIPCollectionVirtualNetworkInterfaceContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPCollectionVirtualNetworkInterfaceContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // FloatingIPPatch : FloatingIPPatch struct type FloatingIPPatch struct { // The name for this floating IP. The name must not be used by another floating IP in the region. @@ -48751,14 +53192,14 @@ func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) // AsPatch returns a generic map representation of the FloatingIPPatch func (floatingIPPatch *FloatingIPPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(floatingIPPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPPatch.Name) { + _patch["name"] = floatingIPPatch.Name } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(floatingIPPatch.Target) { + _patch["target"] = floatingIPPatch.Target.asPatch() } + return } @@ -49025,6 +53466,7 @@ func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool { type FloatingIPTargetPatchIntf interface { isaFloatingIPTargetPatch() bool + asPatch() map[string]interface{} } // UnmarshalFloatingIPTargetPatch unmarshals an instance of FloatingIPTargetPatch from the specified map of raw messages. @@ -49049,6 +53491,22 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa return } +// asPatch returns a generic map representation of the FloatingIPTargetPatch +func (floatingIPTargetPatch *FloatingIPTargetPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatch.ID) { + _patch["id"] = floatingIPTargetPatch.ID + } + if !core.IsNil(floatingIPTargetPatch.Href) { + _patch["href"] = floatingIPTargetPatch.Href + } + if !core.IsNil(floatingIPTargetPatch.CRN) { + _patch["crn"] = floatingIPTargetPatch.CRN + } + + return +} + // FloatingIPTargetPrototype : The target resource to bind this floating IP to. // // The target resource must not already have a floating IP bound to it if the target resource is: @@ -49271,7 +53729,7 @@ func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) // FlowLogCollectorCollection : FlowLogCollectorCollection struct type FlowLogCollectorCollection struct { // A link to the first page of resources. - First *FlowLogCollectorCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of flow log collectors. FlowLogCollectors []FlowLogCollector `json:"flow_log_collectors" validate:"required"` @@ -49281,7 +53739,7 @@ type FlowLogCollectorCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *FlowLogCollectorCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -49290,7 +53748,7 @@ type FlowLogCollectorCollection struct { // UnmarshalFlowLogCollectorCollection unmarshals an instance of FlowLogCollectorCollection from the specified map of raw messages. func UnmarshalFlowLogCollectorCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FlowLogCollectorCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFlowLogCollectorCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -49305,7 +53763,7 @@ func UnmarshalFlowLogCollectorCollection(m map[string]json.RawMessage, result in err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFlowLogCollectorCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -49334,42 +53792,6 @@ func (resp *FlowLogCollectorCollection) GetNextStart() (*string, error) { return start, nil } -// FlowLogCollectorCollectionFirst : A link to the first page of resources. -type FlowLogCollectorCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFlowLogCollectorCollectionFirst unmarshals an instance of FlowLogCollectorCollectionFirst from the specified map of raw messages. -func UnmarshalFlowLogCollectorCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type FlowLogCollectorCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalFlowLogCollectorCollectionNext unmarshals an instance of FlowLogCollectorCollectionNext from the specified map of raw messages. -func UnmarshalFlowLogCollectorCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // FlowLogCollectorPatch : FlowLogCollectorPatch struct type FlowLogCollectorPatch struct { // Indicates whether this collector is active. Updating to false deactivates the collector and updating to true @@ -49399,14 +53821,14 @@ func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interfa // AsPatch returns a generic map representation of the FlowLogCollectorPatch func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(flowLogCollectorPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(flowLogCollectorPatch.Active) { + _patch["active"] = flowLogCollectorPatch.Active } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(flowLogCollectorPatch.Name) { + _patch["name"] = flowLogCollectorPatch.Name } + return } @@ -49615,7 +54037,7 @@ type GetBackupPolicyJobOptions struct { // The backup policy job identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49650,7 +54072,7 @@ type GetBackupPolicyOptions struct { // The backup policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49681,7 +54103,7 @@ type GetBackupPolicyPlanOptions struct { // The backup policy plan identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49719,7 +54141,7 @@ type GetBareMetalServerDiskOptions struct { // The bare metal server disk identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49754,7 +54176,7 @@ type GetBareMetalServerInitializationOptions struct { // The bare metal server identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49785,7 +54207,7 @@ type GetBareMetalServerNetworkAttachmentOptions struct { // The bare metal server network attachment identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49826,7 +54248,7 @@ type GetBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The floating IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49874,7 +54296,7 @@ type GetBareMetalServerNetworkInterfaceIPOptions struct { // The reserved IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49919,7 +54341,7 @@ type GetBareMetalServerNetworkInterfaceOptions struct { // The bare metal server network interface identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49954,7 +54376,7 @@ type GetBareMetalServerOptions struct { // The bare metal server identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -49982,7 +54404,7 @@ type GetBareMetalServerProfileOptions struct { // The bare metal server profile name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50005,6 +54427,186 @@ func (options *GetBareMetalServerProfileOptions) SetHeaders(param map[string]str return options } +// GetClusterNetworkInterfaceOptions : The GetClusterNetworkInterface options. +type GetClusterNetworkInterfaceOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetClusterNetworkInterfaceOptions : Instantiate GetClusterNetworkInterfaceOptions +func (*VpcV1) NewGetClusterNetworkInterfaceOptions(clusterNetworkID string, id string) *GetClusterNetworkInterfaceOptions { + return &GetClusterNetworkInterfaceOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ID: core.StringPtr(id), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *GetClusterNetworkInterfaceOptions) SetClusterNetworkID(clusterNetworkID string) *GetClusterNetworkInterfaceOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetClusterNetworkInterfaceOptions) SetID(id string) *GetClusterNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetClusterNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetClusterNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetClusterNetworkOptions : The GetClusterNetwork options. +type GetClusterNetworkOptions struct { + // The cluster network identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetClusterNetworkOptions : Instantiate GetClusterNetworkOptions +func (*VpcV1) NewGetClusterNetworkOptions(id string) *GetClusterNetworkOptions { + return &GetClusterNetworkOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetClusterNetworkOptions) SetID(id string) *GetClusterNetworkOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetClusterNetworkOptions) SetHeaders(param map[string]string) *GetClusterNetworkOptions { + options.Headers = param + return options +} + +// GetClusterNetworkProfileOptions : The GetClusterNetworkProfile options. +type GetClusterNetworkProfileOptions struct { + // The cluster network profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetClusterNetworkProfileOptions : Instantiate GetClusterNetworkProfileOptions +func (*VpcV1) NewGetClusterNetworkProfileOptions(name string) *GetClusterNetworkProfileOptions { + return &GetClusterNetworkProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetClusterNetworkProfileOptions) SetName(name string) *GetClusterNetworkProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetClusterNetworkProfileOptions) SetHeaders(param map[string]string) *GetClusterNetworkProfileOptions { + options.Headers = param + return options +} + +// GetClusterNetworkSubnetOptions : The GetClusterNetworkSubnet options. +type GetClusterNetworkSubnetOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetClusterNetworkSubnetOptions : Instantiate GetClusterNetworkSubnetOptions +func (*VpcV1) NewGetClusterNetworkSubnetOptions(clusterNetworkID string, id string) *GetClusterNetworkSubnetOptions { + return &GetClusterNetworkSubnetOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ID: core.StringPtr(id), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *GetClusterNetworkSubnetOptions) SetClusterNetworkID(clusterNetworkID string) *GetClusterNetworkSubnetOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetClusterNetworkSubnetOptions) SetID(id string) *GetClusterNetworkSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetClusterNetworkSubnetOptions) SetHeaders(param map[string]string) *GetClusterNetworkSubnetOptions { + options.Headers = param + return options +} + +// GetClusterNetworkSubnetReservedIPOptions : The GetClusterNetworkSubnetReservedIP options. +type GetClusterNetworkSubnetReservedIPOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet identifier. + ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="` + + // The cluster network subnet reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetClusterNetworkSubnetReservedIPOptions : Instantiate GetClusterNetworkSubnetReservedIPOptions +func (*VpcV1) NewGetClusterNetworkSubnetReservedIPOptions(clusterNetworkID string, clusterNetworkSubnetID string, id string) *GetClusterNetworkSubnetReservedIPOptions { + return &GetClusterNetworkSubnetReservedIPOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID), + ID: core.StringPtr(id), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *GetClusterNetworkSubnetReservedIPOptions) SetClusterNetworkID(clusterNetworkID string) *GetClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID +func (_options *GetClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *GetClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetClusterNetworkSubnetReservedIPOptions) SetID(id string) *GetClusterNetworkSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetClusterNetworkSubnetReservedIPOptions) SetHeaders(param map[string]string) *GetClusterNetworkSubnetReservedIPOptions { + options.Headers = param + return options +} + // GetDedicatedHostDiskOptions : The GetDedicatedHostDisk options. type GetDedicatedHostDiskOptions struct { // The dedicated host identifier. @@ -50013,7 +54615,7 @@ type GetDedicatedHostDiskOptions struct { // The dedicated host disk identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50048,7 +54650,7 @@ type GetDedicatedHostGroupOptions struct { // The dedicated host group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50076,7 +54678,7 @@ type GetDedicatedHostOptions struct { // The dedicated host identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50104,7 +54706,7 @@ type GetDedicatedHostProfileOptions struct { // The dedicated host profile name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50135,7 +54737,7 @@ type GetEndpointGatewayIPOptions struct { // The reserved IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50170,7 +54772,7 @@ type GetEndpointGatewayOptions struct { // The endpoint gateway identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50198,7 +54800,7 @@ type GetFloatingIPOptions struct { // The floating IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50226,7 +54828,7 @@ type GetFlowLogCollectorOptions struct { // The flow log collector identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50254,7 +54856,7 @@ type GetIkePolicyOptions struct { // The IKE policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50285,7 +54887,7 @@ type GetImageExportJobOptions struct { // The image export job identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50320,7 +54922,7 @@ type GetImageOptions struct { // The image identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50343,6 +54945,44 @@ func (options *GetImageOptions) SetHeaders(param map[string]string) *GetImageOpt return options } +// GetInstanceClusterNetworkAttachmentOptions : The GetInstanceClusterNetworkAttachment options. +type GetInstanceClusterNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance cluster network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetInstanceClusterNetworkAttachmentOptions : Instantiate GetInstanceClusterNetworkAttachmentOptions +func (*VpcV1) NewGetInstanceClusterNetworkAttachmentOptions(instanceID string, id string) *GetInstanceClusterNetworkAttachmentOptions { + return &GetInstanceClusterNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceClusterNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceClusterNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceClusterNetworkAttachmentOptions) SetID(id string) *GetInstanceClusterNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceClusterNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceClusterNetworkAttachmentOptions { + options.Headers = param + return options +} + // GetInstanceDiskOptions : The GetInstanceDisk options. type GetInstanceDiskOptions struct { // The virtual server instance identifier. @@ -50351,7 +54991,7 @@ type GetInstanceDiskOptions struct { // The instance disk identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50392,7 +55032,7 @@ type GetInstanceGroupManagerActionOptions struct { // The instance group manager action identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50437,7 +55077,7 @@ type GetInstanceGroupManagerOptions struct { // The instance group manager identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50478,7 +55118,7 @@ type GetInstanceGroupManagerPolicyOptions struct { // The instance group manager policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50523,7 +55163,7 @@ type GetInstanceGroupMembershipOptions struct { // The instance group membership identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50558,7 +55198,7 @@ type GetInstanceGroupOptions struct { // The instance group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50586,7 +55226,7 @@ type GetInstanceInitializationOptions struct { // The instance identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50617,7 +55257,7 @@ type GetInstanceNetworkAttachmentOptions struct { // The instance network attachment identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50658,7 +55298,7 @@ type GetInstanceNetworkInterfaceFloatingIPOptions struct { // The floating IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50706,7 +55346,7 @@ type GetInstanceNetworkInterfaceIPOptions struct { // The reserved IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50751,7 +55391,7 @@ type GetInstanceNetworkInterfaceOptions struct { // The instance network interface identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50786,7 +55426,7 @@ type GetInstanceOptions struct { // The virtual server instance identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50814,7 +55454,7 @@ type GetInstanceProfileOptions struct { // The instance profile name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50842,7 +55482,7 @@ type GetInstanceTemplateOptions struct { // The instance template identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50873,7 +55513,7 @@ type GetInstanceVolumeAttachmentOptions struct { // The volume attachment identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50908,7 +55548,7 @@ type GetIpsecPolicyOptions struct { // The IPsec policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50936,7 +55576,7 @@ type GetKeyOptions struct { // The key identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -50967,7 +55607,7 @@ type GetLoadBalancerListenerOptions struct { // The listener identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51008,7 +55648,7 @@ type GetLoadBalancerListenerPolicyOptions struct { // The policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51059,7 +55699,7 @@ type GetLoadBalancerListenerPolicyRuleOptions struct { // The rule identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51108,7 +55748,7 @@ type GetLoadBalancerOptions struct { // The load balancer identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51142,7 +55782,7 @@ type GetLoadBalancerPoolMemberOptions struct { // The member identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51187,7 +55827,7 @@ type GetLoadBalancerPoolOptions struct { // The pool identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51222,7 +55862,7 @@ type GetLoadBalancerProfileOptions struct { // The load balancer profile name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51250,7 +55890,7 @@ type GetLoadBalancerStatisticsOptions struct { // The load balancer identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51278,7 +55918,7 @@ type GetNetworkACLOptions struct { // The network ACL identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51309,7 +55949,7 @@ type GetNetworkACLRuleOptions struct { // The rule identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51347,7 +55987,7 @@ type GetNetworkInterfaceFloatingIPOptions struct { // The floating IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51382,7 +56022,7 @@ type GetOperatingSystemOptions struct { // The operating system name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51410,7 +56050,7 @@ type GetPlacementGroupOptions struct { // The placement group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51441,7 +56081,7 @@ type GetPrivatePathServiceGatewayAccountPolicyOptions struct { // The account policy identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51479,7 +56119,7 @@ type GetPrivatePathServiceGatewayEndpointGatewayBindingOptions struct { // The endpoint gateway binding identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51514,7 +56154,7 @@ type GetPrivatePathServiceGatewayOptions struct { // The private path service gateway identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51542,7 +56182,7 @@ type GetPublicGatewayOptions struct { // The public gateway identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51570,7 +56210,7 @@ type GetRegionOptions struct { // The region name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51601,7 +56241,7 @@ type GetRegionZoneOptions struct { // The zone name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51636,7 +56276,7 @@ type GetReservationOptions struct { // The reservation identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51664,7 +56304,7 @@ type GetSecurityGroupOptions struct { // The security group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51695,7 +56335,7 @@ type GetSecurityGroupRuleOptions struct { // The rule identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51733,7 +56373,7 @@ type GetSecurityGroupTargetOptions struct { // The security group target identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51771,7 +56411,7 @@ type GetShareAccessorBindingOptions struct { // The file share accessor binding identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51809,7 +56449,7 @@ type GetShareMountTargetOptions struct { // The file share mount target identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51844,7 +56484,7 @@ type GetShareOptions struct { // The file share identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51872,7 +56512,7 @@ type GetShareProfileOptions struct { // The file share profile name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51900,7 +56540,7 @@ type GetShareSourceOptions struct { // The file share identifier. ShareID *string `json:"share_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51931,7 +56571,7 @@ type GetSnapshotCloneOptions struct { // The zone name. ZoneName *string `json:"zone_name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51966,7 +56606,7 @@ type GetSnapshotConsistencyGroupOptions struct { // The snapshot consistency group identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -51994,7 +56634,7 @@ type GetSnapshotOptions struct { // The snapshot identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52022,7 +56662,7 @@ type GetSubnetNetworkACLOptions struct { // The subnet identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52050,7 +56690,7 @@ type GetSubnetOptions struct { // The subnet identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52078,7 +56718,7 @@ type GetSubnetPublicGatewayOptions struct { // The subnet identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52109,7 +56749,7 @@ type GetSubnetReservedIPOptions struct { // The reserved IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52144,7 +56784,7 @@ type GetSubnetRoutingTableOptions struct { // The subnet identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52175,7 +56815,7 @@ type GetVirtualNetworkInterfaceIPOptions struct { // The reserved IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52210,7 +56850,7 @@ type GetVirtualNetworkInterfaceOptions struct { // The virtual network interface identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52238,7 +56878,7 @@ type GetVolumeOptions struct { // The volume identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52266,7 +56906,7 @@ type GetVolumeProfileOptions struct { // The volume profile name. Name *string `json:"name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52297,7 +56937,7 @@ type GetVPCAddressPrefixOptions struct { // The prefix identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52332,7 +56972,7 @@ type GetVPCDefaultNetworkACLOptions struct { // The VPC identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52360,7 +57000,7 @@ type GetVPCDefaultRoutingTableOptions struct { // The VPC identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52388,7 +57028,7 @@ type GetVPCDefaultSecurityGroupOptions struct { // The VPC identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52419,7 +57059,7 @@ type GetVPCDnsResolutionBindingOptions struct { // The DNS resolution binding identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52454,7 +57094,7 @@ type GetVPCOptions struct { // The VPC identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52485,7 +57125,7 @@ type GetVPCRouteOptions struct { // The route identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52523,7 +57163,7 @@ type GetVPCRoutingTableOptions struct { // The routing table identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52564,7 +57204,7 @@ type GetVPCRoutingTableRouteOptions struct { // The VPC routing table route identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52609,7 +57249,7 @@ type GetVPNGatewayConnectionOptions struct { // The VPN gateway connection identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52644,7 +57284,7 @@ type GetVPNGatewayOptions struct { // The VPN gateway identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52672,7 +57312,7 @@ type GetVPNServerClientConfigurationOptions struct { // The VPN server identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52703,7 +57343,7 @@ type GetVPNServerClientOptions struct { // The VPN client identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52738,7 +57378,7 @@ type GetVPNServerOptions struct { // The VPN server identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52769,7 +57409,7 @@ type GetVPNServerRouteOptions struct { // The VPN route identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -52975,7 +57615,7 @@ func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err e // IkePolicyCollection : IkePolicyCollection struct type IkePolicyCollection struct { // A link to the first page of resources. - First *IkePolicyCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of IKE policies. IkePolicies []IkePolicy `json:"ike_policies" validate:"required"` @@ -52985,7 +57625,7 @@ type IkePolicyCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *IkePolicyCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -52994,7 +57634,7 @@ type IkePolicyCollection struct { // UnmarshalIkePolicyCollection unmarshals an instance of IkePolicyCollection from the specified map of raw messages. func UnmarshalIkePolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IkePolicyCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIkePolicyCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -53009,7 +57649,7 @@ func UnmarshalIkePolicyCollection(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIkePolicyCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -53044,14 +57684,14 @@ type IkePolicyConnectionCollection struct { Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` // A link to the first page of resources. - First *IkePolicyConnectionCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *IkePolicyConnectionCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -53065,7 +57705,7 @@ func UnmarshalIkePolicyConnectionCollection(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIkePolicyConnectionCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -53075,7 +57715,7 @@ func UnmarshalIkePolicyConnectionCollection(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIkePolicyConnectionCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -53180,14 +57820,26 @@ func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) ( // AsPatch returns a generic map representation of the IkePolicyPatch func (ikePolicyPatch *IkePolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(ikePolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(ikePolicyPatch.AuthenticationAlgorithm) { + _patch["authentication_algorithm"] = ikePolicyPatch.AuthenticationAlgorithm } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(ikePolicyPatch.DhGroup) { + _patch["dh_group"] = ikePolicyPatch.DhGroup + } + if !core.IsNil(ikePolicyPatch.EncryptionAlgorithm) { + _patch["encryption_algorithm"] = ikePolicyPatch.EncryptionAlgorithm + } + if !core.IsNil(ikePolicyPatch.IkeVersion) { + _patch["ike_version"] = ikePolicyPatch.IkeVersion + } + if !core.IsNil(ikePolicyPatch.KeyLifetime) { + _patch["key_lifetime"] = ikePolicyPatch.KeyLifetime } + if !core.IsNil(ikePolicyPatch.Name) { + _patch["name"] = ikePolicyPatch.Name + } + return } @@ -53281,6 +57933,16 @@ func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { return } +// asPatch returns a generic map representation of the IP +func (ip *IP) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(ip.Address) { + _patch["address"] = ip.Address + } + + return +} + // IPsecPolicy : IPsecPolicy struct type IPsecPolicy struct { // The authentication algorithm @@ -53501,7 +58163,7 @@ func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err // IPsecPolicyCollection : IPsecPolicyCollection struct type IPsecPolicyCollection struct { // A link to the first page of resources. - First *IPsecPolicyCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of IPsec policies. IpsecPolicies []IPsecPolicy `json:"ipsec_policies" validate:"required"` @@ -53511,7 +58173,7 @@ type IPsecPolicyCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *IPsecPolicyCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -53520,7 +58182,7 @@ type IPsecPolicyCollection struct { // UnmarshalIPsecPolicyCollection unmarshals an instance of IPsecPolicyCollection from the specified map of raw messages. func UnmarshalIPsecPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IPsecPolicyCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIPsecPolicyCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -53535,7 +58197,7 @@ func UnmarshalIPsecPolicyCollection(m map[string]json.RawMessage, result interfa err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIPsecPolicyCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -53564,56 +58226,20 @@ func (resp *IPsecPolicyCollection) GetNextStart() (*string, error) { return start, nil } -// IPsecPolicyCollectionFirst : A link to the first page of resources. -type IPsecPolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIPsecPolicyCollectionFirst unmarshals an instance of IPsecPolicyCollectionFirst from the specified map of raw messages. -func UnmarshalIPsecPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type IPsecPolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIPsecPolicyCollectionNext unmarshals an instance of IPsecPolicyCollectionNext from the specified map of raw messages. -func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // IPsecPolicyConnectionCollection : IPsecPolicyConnectionCollection struct type IPsecPolicyConnectionCollection struct { // A page of VPN gateway connections that use the IPsec policy specified by the identifier in the URL. Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` // A link to the first page of resources. - First *IPsecPolicyConnectionCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *IPsecPolicyConnectionCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -53627,7 +58253,7 @@ func UnmarshalIPsecPolicyConnectionCollection(m map[string]json.RawMessage, resu err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIPsecPolicyConnectionCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -53637,7 +58263,7 @@ func UnmarshalIPsecPolicyConnectionCollection(m map[string]json.RawMessage, resu err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIPsecPolicyConnectionCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -53666,42 +58292,6 @@ func (resp *IPsecPolicyConnectionCollection) GetNextStart() (*string, error) { return start, nil } -// IPsecPolicyConnectionCollectionFirst : A link to the first page of resources. -type IPsecPolicyConnectionCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIPsecPolicyConnectionCollectionFirst unmarshals an instance of IPsecPolicyConnectionCollectionFirst from the specified map of raw messages. -func UnmarshalIPsecPolicyConnectionCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyConnectionCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicyConnectionCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type IPsecPolicyConnectionCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIPsecPolicyConnectionCollectionNext unmarshals an instance of IPsecPolicyConnectionCollectionNext from the specified map of raw messages. -func UnmarshalIPsecPolicyConnectionCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyConnectionCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // IPsecPolicyPatch : IPsecPolicyPatch struct type IPsecPolicyPatch struct { // The authentication algorithm @@ -53816,14 +58406,23 @@ func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) // AsPatch returns a generic map representation of the IPsecPolicyPatch func (iPsecPolicyPatch *IPsecPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(iPsecPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(iPsecPolicyPatch.AuthenticationAlgorithm) { + _patch["authentication_algorithm"] = iPsecPolicyPatch.AuthenticationAlgorithm } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(iPsecPolicyPatch.EncryptionAlgorithm) { + _patch["encryption_algorithm"] = iPsecPolicyPatch.EncryptionAlgorithm + } + if !core.IsNil(iPsecPolicyPatch.KeyLifetime) { + _patch["key_lifetime"] = iPsecPolicyPatch.KeyLifetime + } + if !core.IsNil(iPsecPolicyPatch.Name) { + _patch["name"] = iPsecPolicyPatch.Name + } + if !core.IsNil(iPsecPolicyPatch.Pfs) { + _patch["pfs"] = iPsecPolicyPatch.Pfs } + return } @@ -53884,78 +58483,6 @@ func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interfac return } -// IkePolicyCollectionFirst : A link to the first page of resources. -type IkePolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIkePolicyCollectionFirst unmarshals an instance of IkePolicyCollectionFirst from the specified map of raw messages. -func UnmarshalIkePolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IkePolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type IkePolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIkePolicyCollectionNext unmarshals an instance of IkePolicyCollectionNext from the specified map of raw messages. -func UnmarshalIkePolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IkePolicyConnectionCollectionFirst : A link to the first page of resources. -type IkePolicyConnectionCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIkePolicyConnectionCollectionFirst unmarshals an instance of IkePolicyConnectionCollectionFirst from the specified map of raw messages. -func UnmarshalIkePolicyConnectionCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyConnectionCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IkePolicyConnectionCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type IkePolicyConnectionCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalIkePolicyConnectionCollectionNext unmarshals an instance of IkePolicyConnectionCollectionNext from the specified map of raw messages. -func UnmarshalIkePolicyConnectionCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyConnectionCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // Image : Image struct type Image struct { CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"` @@ -54248,7 +58775,7 @@ func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interfac // ImageCollection : ImageCollection struct type ImageCollection struct { // A link to the first page of resources. - First *ImageCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of images. Images []Image `json:"images" validate:"required"` @@ -54258,7 +58785,7 @@ type ImageCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ImageCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -54267,7 +58794,7 @@ type ImageCollection struct { // UnmarshalImageCollection unmarshals an instance of ImageCollection from the specified map of raw messages. func UnmarshalImageCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImageCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalImageCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -54282,7 +58809,7 @@ func UnmarshalImageCollection(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalImageCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -54311,42 +58838,6 @@ func (resp *ImageCollection) GetNextStart() (*string, error) { return start, nil } -// ImageCollectionFirst : A link to the first page of resources. -type ImageCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalImageCollectionFirst unmarshals an instance of ImageCollectionFirst from the specified map of raw messages. -func UnmarshalImageCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ImageCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalImageCollectionNext unmarshals an instance of ImageCollectionNext from the specified map of raw messages. -func UnmarshalImageCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ImageExportJob : ImageExportJob struct type ImageExportJob struct { // The date and time that the image export job was completed. @@ -54549,14 +59040,11 @@ func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface // AsPatch returns a generic map representation of the ImageExportJobPatch func (imageExportJobPatch *ImageExportJobPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(imageExportJobPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(imageExportJobPatch.Name) { + _patch["name"] = imageExportJobPatch.Name } + return } @@ -54818,14 +59306,17 @@ func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err // AsPatch returns a generic map representation of the ImagePatch func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(imagePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(imagePatch.DeprecationAt) { + _patch["deprecation_at"] = imagePatch.DeprecationAt } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(imagePatch.Name) { + _patch["name"] = imagePatch.Name } + if !core.IsNil(imagePatch.ObsolescenceAt) { + _patch["obsolescence_at"] = imagePatch.ObsolescenceAt + } + return } @@ -55153,6 +59644,14 @@ type Instance struct { // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user). CatalogOffering *InstanceCatalogOffering `json:"catalog_offering,omitempty"` + // If present, the cluster network that this virtual server instance resides in. + ClusterNetwork *ClusterNetworkReference `json:"cluster_network,omitempty"` + + // The cluster network attachments for this virtual server instance. + // + // The cluster network attachments are ordered for consistent instance configuration. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentReference `json:"cluster_network_attachments" validate:"required"` + // The confidential compute mode for this virtual server instance. ConfidentialComputeMode *string `json:"confidential_compute_mode" validate:"required"` @@ -55372,6 +59871,16 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network", &obj.ClusterNetwork, UnmarshalClusterNetworkReference) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentReference) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -55721,6 +60230,16 @@ func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, resu return } +// asPatch returns a generic map representation of the InstanceAvailabilityPolicyPatch +func (instanceAvailabilityPolicyPatch *InstanceAvailabilityPolicyPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceAvailabilityPolicyPatch.HostFailure) { + _patch["host_failure"] = instanceAvailabilityPolicyPatch.HostFailure + } + + return +} + // InstanceAvailabilityPolicyPrototype : InstanceAvailabilityPolicyPrototype struct type InstanceAvailabilityPolicyPrototype struct { // The action to perform if the compute host experiences a failure. @@ -55838,36 +60357,221 @@ func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, res return } -// InstanceCollection : InstanceCollection struct -type InstanceCollection struct { - // A link to the first page of resources. - First *InstanceCollectionFirst `json:"first" validate:"required"` +// InstanceClusterNetworkAttachment : InstanceClusterNetworkAttachment struct +type InstanceClusterNetworkAttachment struct { + // The instance cluster network attachment that is immediately before. If absent, this is the + // last instance cluster network attachment. + Before *InstanceClusterNetworkAttachmentBefore `json:"before,omitempty"` - // A page of virtual server instances. - Instances []Instance `json:"instances" validate:"required"` + // The cluster network interface for this instance cluster network attachment. + ClusterNetworkInterface *ClusterNetworkInterfaceReference `json:"cluster_network_interface" validate:"required"` + + // The URL for this instance cluster network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance cluster network attachment. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []InstanceClusterNetworkAttachmentLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the instance cluster network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this instance cluster network attachment. The name is unique across all network attachments for the + // instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceClusterNetworkAttachment.LifecycleState property. +// The lifecycle state of the instance cluster network attachment. +const ( + InstanceClusterNetworkAttachmentLifecycleStateDeletingConst = "deleting" + InstanceClusterNetworkAttachmentLifecycleStateFailedConst = "failed" + InstanceClusterNetworkAttachmentLifecycleStatePendingConst = "pending" + InstanceClusterNetworkAttachmentLifecycleStateStableConst = "stable" + InstanceClusterNetworkAttachmentLifecycleStateSuspendedConst = "suspended" + InstanceClusterNetworkAttachmentLifecycleStateUpdatingConst = "updating" + InstanceClusterNetworkAttachmentLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the InstanceClusterNetworkAttachment.ResourceType property. +// The resource type. +const ( + InstanceClusterNetworkAttachmentResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment" +) + +// UnmarshalInstanceClusterNetworkAttachment unmarshals an instance of InstanceClusterNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachment) + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalInstanceClusterNetworkAttachmentBefore) + if err != nil { + err = core.SDKErrorf(err, "", "before-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "cluster_network_interface", &obj.ClusterNetworkInterface, UnmarshalClusterNetworkInterfaceReference) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_interface-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceClusterNetworkAttachmentLifecycleReason) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentBefore : The instance cluster network attachment that is immediately before. If absent, this is the last instance cluster +// network attachment. +type InstanceClusterNetworkAttachmentBefore struct { + // The URL for this instance cluster network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance cluster network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance cluster network attachment. The name is unique across all network attachments for the + // instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceClusterNetworkAttachmentBefore.ResourceType property. +// The resource type. +const ( + InstanceClusterNetworkAttachmentBeforeResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment" +) + +// UnmarshalInstanceClusterNetworkAttachmentBefore unmarshals an instance of InstanceClusterNetworkAttachmentBefore from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentBefore(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentBefore) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentBeforePrototype : The instance cluster network attachment to insert this instance cluster network attachment immediately before. +// +// If unspecified, this instance cluster network attachment will be inserted after all existing instance cluster network +// attachments. +// Models which "extend" this model: +// - InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID +// - InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref +type InstanceClusterNetworkAttachmentBeforePrototype struct { + // The unique identifier for this instance cluster network attachment. + ID *string `json:"id,omitempty"` + + // The URL for this instance cluster network attachment. + Href *string `json:"href,omitempty"` +} + +func (*InstanceClusterNetworkAttachmentBeforePrototype) isaInstanceClusterNetworkAttachmentBeforePrototype() bool { + return true +} + +type InstanceClusterNetworkAttachmentBeforePrototypeIntf interface { + isaInstanceClusterNetworkAttachmentBeforePrototype() bool +} + +// UnmarshalInstanceClusterNetworkAttachmentBeforePrototype unmarshals an instance of InstanceClusterNetworkAttachmentBeforePrototype from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentBeforePrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentCollection : InstanceClusterNetworkAttachmentCollection struct +type InstanceClusterNetworkAttachmentCollection struct { + // A page of ordered cluster network attachments (sorted based on the `before` property) for the instance. A cluster + // network attachment represents a device to which a cluster network interface is attached. + ClusterNetworkAttachments []InstanceClusterNetworkAttachment `json:"cluster_network_attachments" validate:"required"` + + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *InstanceCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalInstanceCollection unmarshals an instance of InstanceCollection from the specified map of raw messages. -func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceCollectionFirst) +// UnmarshalInstanceClusterNetworkAttachmentCollection unmarshals an instance of InstanceClusterNetworkAttachmentCollection from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentCollection) + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachment) if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstance) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "instances-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) @@ -55875,7 +60579,7 @@ func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{ err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -55890,7 +60594,7 @@ func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{ } // Retrieve the value to be passed to a request to access the next page of results -func (resp *InstanceCollection) GetNextStart() (*string, error) { +func (resp *InstanceClusterNetworkAttachmentCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -55904,15 +60608,167 @@ func (resp *InstanceCollection) GetNextStart() (*string, error) { return start, nil } -// InstanceCollectionFirst : A link to the first page of resources. -type InstanceCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` +// InstanceClusterNetworkAttachmentLifecycleReason : InstanceClusterNetworkAttachmentLifecycleReason struct +type InstanceClusterNetworkAttachmentLifecycleReason struct { + // A reason code for this lifecycle state: + // - `internal_error`: internal error (contact IBM support) + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this lifecycle state. + Message *string `json:"message" validate:"required"` + + // Link to documentation about the reason for this lifecycle state. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the InstanceClusterNetworkAttachmentLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `internal_error`: internal error (contact IBM support) +// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM +// support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + InstanceClusterNetworkAttachmentLifecycleReasonCodeInternalErrorConst = "internal_error" + InstanceClusterNetworkAttachmentLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalInstanceClusterNetworkAttachmentLifecycleReason unmarshals an instance of InstanceClusterNetworkAttachmentLifecycleReason from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentPatch : InstanceClusterNetworkAttachmentPatch struct +type InstanceClusterNetworkAttachmentPatch struct { + // The name for this network attachment. The name must not be used by another network attachment for the instance. + // Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceClusterNetworkAttachmentPatch unmarshals an instance of InstanceClusterNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceClusterNetworkAttachmentPatch +func (instanceClusterNetworkAttachmentPatch *InstanceClusterNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceClusterNetworkAttachmentPatch.Name) { + _patch["name"] = instanceClusterNetworkAttachmentPatch.Name + } + + return +} + +// InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface : A cluster network interface for the instance cluster network attachment. This can be specified using an existing +// cluster network interface that does not already have a `target`, or a prototype object for a new cluster network +// interface. +// +// This instance must reside in the same VPC as the specified cluster network interface. The cluster network interface +// must reside in the same cluster network as the +// `cluster_network_interface` of any other `cluster_network_attachments` for this instance. +// Models which "extend" this model: +// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment +// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity +type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface struct { + // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this cluster network interface. The name must not be used by another interface in the cluster network. + // Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the cluster network interface. May be either + // a cluster network subnet reserved IP identity, or a cluster network subnet reserved IP + // prototype object which will be used to create a new cluster network subnet reserved IP. + // + // If a cluster network subnet reserved IP identity is provided, the specified cluster + // network subnet reserved IP must be unbound. + // + // If a cluster network subnet reserved IP prototype object with an address is provided, + // the address must be available on the cluster network interface's cluster network + // subnet. If no address is specified, an available address on the cluster network subnet + // will be automatically selected and reserved. + PrimaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The associated cluster network subnet. Required if `primary_ip` does not specify a + // cluster network subnet reserved IP identity. + Subnet ClusterNetworkSubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this cluster network interface. + ID *string `json:"id,omitempty"` + + // The URL for this cluster network interface. + Href *string `json:"href,omitempty"` } -// UnmarshalInstanceCollectionFirst unmarshals an instance of InstanceCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCollectionFirst) +func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface() bool { + return true +} + +type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf interface { + isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface() bool +} + +// UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface unmarshals an instance of InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkInterfacePrimaryIPPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -55922,24 +60778,167 @@ func UnmarshalInstanceCollectionFirst(m map[string]json.RawMessage, result inter return } -// InstanceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceCollectionNext struct { - // The URL for a page of resources. +// InstanceClusterNetworkAttachmentPrototypeInstanceContext : InstanceClusterNetworkAttachmentPrototypeInstanceContext struct +type InstanceClusterNetworkAttachmentPrototypeInstanceContext struct { + // A cluster network interface for the instance cluster network attachment. This can be + // specified using an existing cluster network interface that does not already have a `target`, + // or a prototype object for a new cluster network interface. + // + // This instance must reside in the same VPC as the specified cluster network interface. The + // cluster network interface must reside in the same cluster network as the + // `cluster_network_interface` of any other `cluster_network_attachments` for this instance. + ClusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf `json:"cluster_network_interface" validate:"required"` + + // The name for this cluster network attachment. Names must be unique within the instance the cluster network + // attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. Names starting + // with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// NewInstanceClusterNetworkAttachmentPrototypeInstanceContext : Instantiate InstanceClusterNetworkAttachmentPrototypeInstanceContext (Generic Model Constructor) +func (*VpcV1) NewInstanceClusterNetworkAttachmentPrototypeInstanceContext(clusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf) (_model *InstanceClusterNetworkAttachmentPrototypeInstanceContext, err error) { + _model = &InstanceClusterNetworkAttachmentPrototypeInstanceContext{ + ClusterNetworkInterface: clusterNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext unmarshals an instance of InstanceClusterNetworkAttachmentPrototypeInstanceContext from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "cluster_network_interface", &obj.ClusterNetworkInterface, UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_interface-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentReference : InstanceClusterNetworkAttachmentReference struct +type InstanceClusterNetworkAttachmentReference struct { + // The URL for this instance cluster network attachment. Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance cluster network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance cluster network attachment. The name is unique across all network attachments for the + // instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// UnmarshalInstanceCollectionNext unmarshals an instance of InstanceCollectionNext from the specified map of raw messages. -func UnmarshalInstanceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCollectionNext) +// Constants associated with the InstanceClusterNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + InstanceClusterNetworkAttachmentReferenceResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment" +) + +// UnmarshalInstanceClusterNetworkAttachmentReference unmarshals an instance of InstanceClusterNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } +// InstanceCollection : InstanceCollection struct +type InstanceCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // A page of virtual server instances. + Instances []Instance `json:"instances" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceCollection unmarshals an instance of InstanceCollection from the specified map of raw messages. +func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstance) + if err != nil { + err = core.SDKErrorf(err, "", "instances-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *InstanceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + // InstanceConsoleAccessToken : The instance console access token information. type InstanceConsoleAccessToken struct { // A URL safe single-use token used to access the console WebSocket. @@ -56169,14 +61168,11 @@ func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{} // AsPatch returns a generic map representation of the InstanceDiskPatch func (instanceDiskPatch *InstanceDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceDiskPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(instanceDiskPatch.Name) { + _patch["name"] = instanceDiskPatch.Name } + return } @@ -56467,7 +61463,7 @@ func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (e // InstanceGroupCollection : InstanceGroupCollection struct type InstanceGroupCollection struct { // A link to the first page of resources. - First *InstanceGroupCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of instance groups. InstanceGroups []InstanceGroup `json:"instance_groups" validate:"required"` @@ -56477,7 +61473,7 @@ type InstanceGroupCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *InstanceGroupCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -56486,7 +61482,7 @@ type InstanceGroupCollection struct { // UnmarshalInstanceGroupCollection unmarshals an instance of InstanceGroupCollection from the specified map of raw messages. func UnmarshalInstanceGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -56501,7 +61497,7 @@ func UnmarshalInstanceGroupCollection(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -56530,42 +61526,6 @@ func (resp *InstanceGroupCollection) GetNextStart() (*string, error) { return start, nil } -// InstanceGroupCollectionFirst : A link to the first page of resources. -type InstanceGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupCollectionFirst unmarshals an instance of InstanceGroupCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupCollectionNext unmarshals an instance of InstanceGroupCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // InstanceGroupLifecycleReason : InstanceGroupLifecycleReason struct type InstanceGroupLifecycleReason struct { // A reason code for this lifecycle state: @@ -56949,6 +61909,16 @@ func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, return } +// asPatch returns a generic map representation of the InstanceGroupManagerActionGroupPatch +func (instanceGroupManagerActionGroupPatch *InstanceGroupManagerActionGroupPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupManagerActionGroupPatch.MembershipCount) { + _patch["membership_count"] = instanceGroupManagerActionGroupPatch.MembershipCount + } + + return +} + // InstanceGroupManagerActionManagerPatch : InstanceGroupManagerActionManagerPatch struct type InstanceGroupManagerActionManagerPatch struct { // The desired maximum number of instance group members at the scheduled time. @@ -56975,6 +61945,19 @@ func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessag return } +// asPatch returns a generic map representation of the InstanceGroupManagerActionManagerPatch +func (instanceGroupManagerActionManagerPatch *InstanceGroupManagerActionManagerPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupManagerActionManagerPatch.MaxMembershipCount) { + _patch["max_membership_count"] = instanceGroupManagerActionManagerPatch.MaxMembershipCount + } + if !core.IsNil(instanceGroupManagerActionManagerPatch.MinMembershipCount) { + _patch["min_membership_count"] = instanceGroupManagerActionManagerPatch.MinMembershipCount + } + + return +} + // InstanceGroupManagerActionPatch : InstanceGroupManagerActionPatch struct type InstanceGroupManagerActionPatch struct { // Indicates whether this scheduled action will be automatically deleted after it has completed and @@ -57045,14 +62028,29 @@ func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, resu // AsPatch returns a generic map representation of the InstanceGroupManagerActionPatch func (instanceGroupManagerActionPatch *InstanceGroupManagerActionPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupManagerActionPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupManagerActionPatch.AutoDelete) { + _patch["auto_delete"] = instanceGroupManagerActionPatch.AutoDelete } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(instanceGroupManagerActionPatch.AutoDeleteTimeout) { + _patch["auto_delete_timeout"] = instanceGroupManagerActionPatch.AutoDeleteTimeout + } + if !core.IsNil(instanceGroupManagerActionPatch.CronSpec) { + _patch["cron_spec"] = instanceGroupManagerActionPatch.CronSpec + } + if !core.IsNil(instanceGroupManagerActionPatch.Group) { + _patch["group"] = instanceGroupManagerActionPatch.Group.asPatch() + } + if !core.IsNil(instanceGroupManagerActionPatch.Manager) { + _patch["manager"] = instanceGroupManagerActionPatch.Manager.asPatch() } + if !core.IsNil(instanceGroupManagerActionPatch.Name) { + _patch["name"] = instanceGroupManagerActionPatch.Name + } + if !core.IsNil(instanceGroupManagerActionPatch.RunAt) { + _patch["run_at"] = instanceGroupManagerActionPatch.RunAt + } + return } @@ -57180,14 +62178,14 @@ type InstanceGroupManagerActionsCollection struct { Actions []InstanceGroupManagerActionIntf `json:"actions" validate:"required"` // A link to the first page of resources. - First *InstanceGroupManagerActionsCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *InstanceGroupManagerActionsCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -57201,7 +62199,7 @@ func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerActionsCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -57211,7 +62209,7 @@ func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerActionsCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -57240,46 +62238,10 @@ func (resp *InstanceGroupManagerActionsCollection) GetNextStart() (*string, erro return start, nil } -// InstanceGroupManagerActionsCollectionFirst : A link to the first page of resources. -type InstanceGroupManagerActionsCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionsCollectionFirst unmarshals an instance of InstanceGroupManagerActionsCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionsCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionsCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionsCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupManagerActionsCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionsCollectionNext unmarshals an instance of InstanceGroupManagerActionsCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionsCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionsCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // InstanceGroupManagerCollection : InstanceGroupManagerCollection struct type InstanceGroupManagerCollection struct { // A link to the first page of resources. - First *InstanceGroupManagerCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` @@ -57289,7 +62251,7 @@ type InstanceGroupManagerCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *InstanceGroupManagerCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -57298,7 +62260,7 @@ type InstanceGroupManagerCollection struct { // UnmarshalInstanceGroupManagerCollection unmarshals an instance of InstanceGroupManagerCollection from the specified map of raw messages. func UnmarshalInstanceGroupManagerCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupManagerCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -57313,7 +62275,7 @@ func UnmarshalInstanceGroupManagerCollection(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -57342,42 +62304,6 @@ func (resp *InstanceGroupManagerCollection) GetNextStart() (*string, error) { return start, nil } -// InstanceGroupManagerCollectionFirst : A link to the first page of resources. -type InstanceGroupManagerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerCollectionFirst unmarshals an instance of InstanceGroupManagerCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupManagerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupManagerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerCollectionNext unmarshals an instance of InstanceGroupManagerCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupManagerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // InstanceGroupManagerPatch : InstanceGroupManagerPatch struct type InstanceGroupManagerPatch struct { // The time window in seconds to aggregate metrics prior to evaluation. @@ -57438,14 +62364,26 @@ func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result int // AsPatch returns a generic map representation of the InstanceGroupManagerPatch func (instanceGroupManagerPatch *InstanceGroupManagerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupManagerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupManagerPatch.AggregationWindow) { + _patch["aggregation_window"] = instanceGroupManagerPatch.AggregationWindow } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(instanceGroupManagerPatch.Cooldown) { + _patch["cooldown"] = instanceGroupManagerPatch.Cooldown + } + if !core.IsNil(instanceGroupManagerPatch.ManagementEnabled) { + _patch["management_enabled"] = instanceGroupManagerPatch.ManagementEnabled + } + if !core.IsNil(instanceGroupManagerPatch.MaxMembershipCount) { + _patch["max_membership_count"] = instanceGroupManagerPatch.MaxMembershipCount + } + if !core.IsNil(instanceGroupManagerPatch.MinMembershipCount) { + _patch["min_membership_count"] = instanceGroupManagerPatch.MinMembershipCount + } + if !core.IsNil(instanceGroupManagerPatch.Name) { + _patch["name"] = instanceGroupManagerPatch.Name } + return } @@ -57564,14 +62502,14 @@ func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result in // InstanceGroupManagerPolicyCollection : InstanceGroupManagerPolicyCollection struct type InstanceGroupManagerPolicyCollection struct { // A link to the first page of resources. - First *InstanceGroupManagerPolicyCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *InstanceGroupManagerPolicyCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of policies for the instance group manager. Policies []InstanceGroupManagerPolicyIntf `json:"policies" validate:"required"` @@ -57583,7 +62521,7 @@ type InstanceGroupManagerPolicyCollection struct { // UnmarshalInstanceGroupManagerPolicyCollection unmarshals an instance of InstanceGroupManagerPolicyCollection from the specified map of raw messages. func UnmarshalInstanceGroupManagerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupManagerPolicyCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerPolicyCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -57593,7 +62531,7 @@ func UnmarshalInstanceGroupManagerPolicyCollection(m map[string]json.RawMessage, err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerPolicyCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -57627,42 +62565,6 @@ func (resp *InstanceGroupManagerPolicyCollection) GetNextStart() (*string, error return start, nil } -// InstanceGroupManagerPolicyCollectionFirst : A link to the first page of resources. -type InstanceGroupManagerPolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyCollectionFirst unmarshals an instance of InstanceGroupManagerPolicyCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupManagerPolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyCollectionNext unmarshals an instance of InstanceGroupManagerPolicyCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // InstanceGroupManagerPolicyPatch : InstanceGroupManagerPolicyPatch struct type InstanceGroupManagerPolicyPatch struct { // The type of metric to be evaluated. @@ -57709,14 +62611,17 @@ func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, resu // AsPatch returns a generic map representation of the InstanceGroupManagerPolicyPatch func (instanceGroupManagerPolicyPatch *InstanceGroupManagerPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupManagerPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupManagerPolicyPatch.MetricType) { + _patch["metric_type"] = instanceGroupManagerPolicyPatch.MetricType } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(instanceGroupManagerPolicyPatch.MetricValue) { + _patch["metric_value"] = instanceGroupManagerPolicyPatch.MetricValue } + if !core.IsNil(instanceGroupManagerPolicyPatch.Name) { + _patch["name"] = instanceGroupManagerPolicyPatch.Name + } + return } @@ -58244,7 +63149,7 @@ func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result inter // InstanceGroupMembershipCollection : InstanceGroupMembershipCollection struct type InstanceGroupMembershipCollection struct { // A link to the first page of resources. - First *InstanceGroupMembershipCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` @@ -58254,7 +63159,7 @@ type InstanceGroupMembershipCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *InstanceGroupMembershipCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -58263,7 +63168,7 @@ type InstanceGroupMembershipCollection struct { // UnmarshalInstanceGroupMembershipCollection unmarshals an instance of InstanceGroupMembershipCollection from the specified map of raw messages. func UnmarshalInstanceGroupMembershipCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupMembershipCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupMembershipCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -58278,7 +63183,7 @@ func UnmarshalInstanceGroupMembershipCollection(m map[string]json.RawMessage, re err = core.SDKErrorf(err, "", "memberships-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -58307,42 +63212,6 @@ func (resp *InstanceGroupMembershipCollection) GetNextStart() (*string, error) { return start, nil } -// InstanceGroupMembershipCollectionFirst : A link to the first page of resources. -type InstanceGroupMembershipCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupMembershipCollectionFirst unmarshals an instance of InstanceGroupMembershipCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceGroupMembershipCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembershipCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupMembershipCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceGroupMembershipCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceGroupMembershipCollectionNext unmarshals an instance of InstanceGroupMembershipCollectionNext from the specified map of raw messages. -func UnmarshalInstanceGroupMembershipCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembershipCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct type InstanceGroupMembershipPatch struct { // If set to true, when deleting the membership the instance will also be deleted. @@ -58372,14 +63241,14 @@ func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result // AsPatch returns a generic map representation of the InstanceGroupMembershipPatch func (instanceGroupMembershipPatch *InstanceGroupMembershipPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupMembershipPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupMembershipPatch.DeleteInstanceOnMembershipDelete) { + _patch["delete_instance_on_membership_delete"] = instanceGroupMembershipPatch.DeleteInstanceOnMembershipDelete } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(instanceGroupMembershipPatch.Name) { + _patch["name"] = instanceGroupMembershipPatch.Name } + return } @@ -58463,14 +63332,33 @@ func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{ // AsPatch returns a generic map representation of the InstanceGroupPatch func (instanceGroupPatch *InstanceGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(instanceGroupPatch.ApplicationPort) { + _patch["application_port"] = instanceGroupPatch.ApplicationPort } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(instanceGroupPatch.InstanceTemplate) { + _patch["instance_template"] = instanceGroupPatch.InstanceTemplate.asPatch() + } + if !core.IsNil(instanceGroupPatch.LoadBalancer) { + _patch["load_balancer"] = instanceGroupPatch.LoadBalancer.asPatch() } + if !core.IsNil(instanceGroupPatch.LoadBalancerPool) { + _patch["load_balancer_pool"] = instanceGroupPatch.LoadBalancerPool.asPatch() + } + if !core.IsNil(instanceGroupPatch.MembershipCount) { + _patch["membership_count"] = instanceGroupPatch.MembershipCount + } + if !core.IsNil(instanceGroupPatch.Name) { + _patch["name"] = instanceGroupPatch.Name + } + if !core.IsNil(instanceGroupPatch.Subnets) { + var subnetsPatches []map[string]interface{} + for _, subnets := range instanceGroupPatch.Subnets { + subnetsPatches = append(subnetsPatches, subnets.asPatch()) + } + _patch["subnets"] = subnetsPatches + } + return } @@ -58833,6 +63721,22 @@ func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the InstanceMetadataServicePatch +func (instanceMetadataServicePatch *InstanceMetadataServicePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceMetadataServicePatch.Enabled) { + _patch["enabled"] = instanceMetadataServicePatch.Enabled + } + if !core.IsNil(instanceMetadataServicePatch.Protocol) { + _patch["protocol"] = instanceMetadataServicePatch.Protocol + } + if !core.IsNil(instanceMetadataServicePatch.ResponseHopLimit) { + _patch["response_hop_limit"] = instanceMetadataServicePatch.ResponseHopLimit + } + + return +} + // InstanceMetadataServicePrototype : The metadata service configuration. type InstanceMetadataServicePrototype struct { // Indicates whether the metadata service endpoint will be available to the virtual server instance. @@ -59043,14 +63947,11 @@ func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, resul // AsPatch returns a generic map representation of the InstanceNetworkAttachmentPatch func (instanceNetworkAttachmentPatch *InstanceNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceNetworkAttachmentPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(instanceNetworkAttachmentPatch.Name) { + _patch["name"] = instanceNetworkAttachmentPatch.Name } + return } @@ -59398,12 +64299,12 @@ type InstancePatch struct { // If set, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPatchIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. For the profile to be changed, - // the instance `status` must be `stopping` or `stopped`. In addition, the requested - // profile must: - // - Have matching instance disk support. Any disks associated with the current profile - // will be deleted, and any disks associated with the requested profile will be - // created. + // The profile to use for this virtual server instance. Any disks associated with the + // current profile will be deleted, and any disks associated with the requested profile + // will be created. + // + // For the profile to be changed, the instance `status` must be `stopping` or `stopped`. + // In addition, the requested profile must: // - Be compatible with any `placement_target` constraints. For example, if the // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. @@ -59484,22 +64385,43 @@ func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (e // AsPatch returns a generic map representation of the InstancePatch func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instancePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(instancePatch.AvailabilityPolicy) { + _patch["availability_policy"] = instancePatch.AvailabilityPolicy.asPatch() } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(instancePatch.ConfidentialComputeMode) { + _patch["confidential_compute_mode"] = instancePatch.ConfidentialComputeMode + } + if !core.IsNil(instancePatch.EnableSecureBoot) { + _patch["enable_secure_boot"] = instancePatch.EnableSecureBoot + } + if !core.IsNil(instancePatch.MetadataService) { + _patch["metadata_service"] = instancePatch.MetadataService.asPatch() + } + if !core.IsNil(instancePatch.Name) { + _patch["name"] = instancePatch.Name + } + if !core.IsNil(instancePatch.PlacementTarget) { + _patch["placement_target"] = instancePatch.PlacementTarget.asPatch() + } + if !core.IsNil(instancePatch.Profile) { + _patch["profile"] = instancePatch.Profile.asPatch() + } + if !core.IsNil(instancePatch.ReservationAffinity) { + _patch["reservation_affinity"] = instancePatch.ReservationAffinity.asPatch() } + if !core.IsNil(instancePatch.TotalVolumeBandwidth) { + _patch["total_volume_bandwidth"] = instancePatch.TotalVolumeBandwidth + } + return } -// InstancePatchProfile : The profile to use for this virtual server instance. For the profile to be changed, the instance `status` must be -// `stopping` or `stopped`. In addition, the requested profile must: -// - Have matching instance disk support. Any disks associated with the current profile -// will be deleted, and any disks associated with the requested profile will be -// created. +// InstancePatchProfile : The profile to use for this virtual server instance. Any disks associated with the current profile will be deleted, +// and any disks associated with the requested profile will be created. +// +// For the profile to be changed, the instance `status` must be `stopping` or `stopped`. In addition, the requested +// profile must: // - Be compatible with any `placement_target` constraints. For example, if the // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. @@ -59524,6 +64446,7 @@ func (*InstancePatchProfile) isaInstancePatchProfile() bool { type InstancePatchProfileIntf interface { isaInstancePatchProfile() bool + asPatch() map[string]interface{} } // UnmarshalInstancePatchProfile unmarshals an instance of InstancePatchProfile from the specified map of raw messages. @@ -59543,6 +64466,19 @@ func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interfac return } +// asPatch returns a generic map representation of the InstancePatchProfile +func (instancePatchProfile *InstancePatchProfile) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePatchProfile.Name) { + _patch["name"] = instancePatchProfile.Name + } + if !core.IsNil(instancePatchProfile.Href) { + _patch["href"] = instancePatchProfile.Href + } + + return +} + // InstancePlacementTarget : InstancePlacementTarget struct // Models which "extend" this model: // - InstancePlacementTargetDedicatedHostGroupReference @@ -59641,6 +64577,7 @@ func (*InstancePlacementTargetPatch) isaInstancePlacementTargetPatch() bool { type InstancePlacementTargetPatchIntf interface { isaInstancePlacementTargetPatch() bool + asPatch() map[string]interface{} } // UnmarshalInstancePlacementTargetPatch unmarshals an instance of InstancePlacementTargetPatch from the specified map of raw messages. @@ -59665,6 +64602,22 @@ func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatch +func (instancePlacementTargetPatch *InstancePlacementTargetPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatch.ID) { + _patch["id"] = instancePlacementTargetPatch.ID + } + if !core.IsNil(instancePlacementTargetPatch.CRN) { + _patch["crn"] = instancePlacementTargetPatch.CRN + } + if !core.IsNil(instancePlacementTargetPatch.Href) { + _patch["href"] = instancePlacementTargetPatch.Href + } + + return +} + // InstancePlacementTargetPrototype : InstancePlacementTargetPrototype struct // Models which "extend" this model: // - InstancePlacementTargetPrototypeDedicatedHostIdentity @@ -59715,6 +64668,8 @@ func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, res type InstanceProfile struct { Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"` + ClusterNetworkAttachmentCount InstanceProfileClusterNetworkAttachmentCountIntf `json:"cluster_network_attachment_count" validate:"required"` + ConfidentialComputeModes *InstanceProfileSupportedConfidentialComputeModes `json:"confidential_compute_modes" validate:"required"` // The disks for an instance with this profile. @@ -59769,6 +64724,9 @@ type InstanceProfile struct { // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Status *string `json:"status" validate:"required"` + // The cluster network profiles that support this instance profile. + SupportedClusterNetworkProfiles []ClusterNetworkProfileReference `json:"supported_cluster_network_profiles" validate:"required"` + TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` @@ -59809,6 +64767,11 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachment_count", &obj.ClusterNetworkAttachmentCount, UnmarshalInstanceProfileClusterNetworkAttachmentCount) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachment_count-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "confidential_compute_modes", &obj.ConfidentialComputeModes, UnmarshalInstanceProfileSupportedConfidentialComputeModes) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_modes-error", common.GetComponentInfo()) @@ -59904,6 +64867,11 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "supported_cluster_network_profiles", &obj.SupportedClusterNetworkProfiles, UnmarshalClusterNetworkProfileReference) + if err != nil { + err = core.SDKErrorf(err, "", "supported_cluster_network_profiles-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth, UnmarshalInstanceProfileVolumeBandwidth) if err != nil { err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo()) @@ -60013,6 +64981,80 @@ func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result inte return } +// InstanceProfileClusterNetworkAttachmentCount : InstanceProfileClusterNetworkAttachmentCount struct +// Models which "extend" this model: +// - InstanceProfileClusterNetworkAttachmentCountDependent +// - InstanceProfileClusterNetworkAttachmentCountEnum +// - InstanceProfileClusterNetworkAttachmentCountRange +type InstanceProfileClusterNetworkAttachmentCount struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + Default *int64 `json:"default,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + Step *int64 `json:"step,omitempty"` +} + +// Constants associated with the InstanceProfileClusterNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + InstanceProfileClusterNetworkAttachmentCountTypeDependentConst = "dependent" +) + +func (*InstanceProfileClusterNetworkAttachmentCount) isaInstanceProfileClusterNetworkAttachmentCount() bool { + return true +} + +type InstanceProfileClusterNetworkAttachmentCountIntf interface { + isaInstanceProfileClusterNetworkAttachmentCount() bool +} + +// UnmarshalInstanceProfileClusterNetworkAttachmentCount unmarshals an instance of InstanceProfileClusterNetworkAttachmentCount from the specified map of raw messages. +func UnmarshalInstanceProfileClusterNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileClusterNetworkAttachmentCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileCollection : InstanceProfileCollection struct type InstanceProfileCollection struct { // A page of virtual server instance profiles. @@ -61317,6 +66359,11 @@ type InstancePrototype struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -61453,6 +66500,11 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -61707,6 +66759,23 @@ func UnmarshalInstanceReservationAffinityPatch(m map[string]json.RawMessage, res return } +// asPatch returns a generic map representation of the InstanceReservationAffinityPatch +func (instanceReservationAffinityPatch *InstanceReservationAffinityPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceReservationAffinityPatch.Policy) { + _patch["policy"] = instanceReservationAffinityPatch.Policy + } + if !core.IsNil(instanceReservationAffinityPatch.Pool) { + var poolPatches []map[string]interface{} + for _, pool := range instanceReservationAffinityPatch.Pool { + poolPatches = append(poolPatches, pool.asPatch()) + } + _patch["pool"] = poolPatches + } + + return +} + // InstanceReservationAffinityPrototype : InstanceReservationAffinityPrototype struct type InstanceReservationAffinityPrototype struct { // The reservation affinity policy to use for this virtual server instance: @@ -61820,6 +66889,11 @@ type InstanceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -61961,6 +67035,11 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -62098,14 +67177,14 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) // InstanceTemplateCollection : InstanceTemplateCollection struct type InstanceTemplateCollection struct { // A link to the first page of resources. - First *InstanceTemplateCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *InstanceTemplateCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of instance templates. Templates []InstanceTemplateIntf `json:"templates" validate:"required"` @@ -62117,7 +67196,7 @@ type InstanceTemplateCollection struct { // UnmarshalInstanceTemplateCollection unmarshals an instance of InstanceTemplateCollection from the specified map of raw messages. func UnmarshalInstanceTemplateCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplateCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceTemplateCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -62127,7 +67206,7 @@ func UnmarshalInstanceTemplateCollection(m map[string]json.RawMessage, result in err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceTemplateCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -62146,42 +67225,6 @@ func UnmarshalInstanceTemplateCollection(m map[string]json.RawMessage, result in return } -// InstanceTemplateCollectionFirst : A link to the first page of resources. -type InstanceTemplateCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceTemplateCollectionFirst unmarshals an instance of InstanceTemplateCollectionFirst from the specified map of raw messages. -func UnmarshalInstanceTemplateCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type InstanceTemplateCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalInstanceTemplateCollectionNext unmarshals an instance of InstanceTemplateCollectionNext from the specified map of raw messages. -func UnmarshalInstanceTemplateCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // InstanceTemplateIdentity : Identifies an instance template by a unique property. // Models which "extend" this model: // - InstanceTemplateIdentityByID @@ -62204,6 +67247,7 @@ func (*InstanceTemplateIdentity) isaInstanceTemplateIdentity() bool { type InstanceTemplateIdentityIntf interface { isaInstanceTemplateIdentity() bool + asPatch() map[string]interface{} } // UnmarshalInstanceTemplateIdentity unmarshals an instance of InstanceTemplateIdentity from the specified map of raw messages. @@ -62228,6 +67272,22 @@ func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the InstanceTemplateIdentity +func (instanceTemplateIdentity *InstanceTemplateIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceTemplateIdentity.ID) { + _patch["id"] = instanceTemplateIdentity.ID + } + if !core.IsNil(instanceTemplateIdentity.Href) { + _patch["href"] = instanceTemplateIdentity.Href + } + if !core.IsNil(instanceTemplateIdentity.CRN) { + _patch["crn"] = instanceTemplateIdentity.CRN + } + + return +} + // InstanceTemplatePatch : InstanceTemplatePatch struct type InstanceTemplatePatch struct { // The name for this instance template. The name must not be used by another instance template in the region. @@ -62248,14 +67308,11 @@ func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interfa // AsPatch returns a generic map representation of the InstanceTemplatePatch func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(instanceTemplatePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(instanceTemplatePatch.Name) { + _patch["name"] = instanceTemplatePatch.Name } + return } @@ -62269,6 +67326,11 @@ type InstanceTemplatePrototype struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -62405,6 +67467,11 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -62717,7 +67784,7 @@ func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) // KeyCollection : KeyCollection struct type KeyCollection struct { // A link to the first page of resources. - First *KeyCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of keys. Keys []Key `json:"keys" validate:"required"` @@ -62727,7 +67794,7 @@ type KeyCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *KeyCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -62736,7 +67803,7 @@ type KeyCollection struct { // UnmarshalKeyCollection unmarshals an instance of KeyCollection from the specified map of raw messages. func UnmarshalKeyCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(KeyCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalKeyCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -62751,7 +67818,7 @@ func UnmarshalKeyCollection(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalKeyCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -62780,42 +67847,6 @@ func (resp *KeyCollection) GetNextStart() (*string, error) { return start, nil } -// KeyCollectionFirst : A link to the first page of resources. -type KeyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalKeyCollectionFirst unmarshals an instance of KeyCollectionFirst from the specified map of raw messages. -func UnmarshalKeyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type KeyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalKeyCollectionNext unmarshals an instance of KeyCollectionNext from the specified map of raw messages. -func UnmarshalKeyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // KeyIdentity : Identifies a key by a unique property. // Models which "extend" this model: // - KeyIdentityByID @@ -62892,14 +67923,11 @@ func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err er // AsPatch returns a generic map representation of the KeyPatch func (keyPatch *KeyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(keyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(keyPatch.Name) { + _patch["name"] = keyPatch.Name } + return } @@ -63026,7 +68054,7 @@ type ListBackupPoliciesOptions struct { // Filters the collection to resources with an item in the `tags` property matching the exact specified tag. Tag *string `json:"tag,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63105,7 +68133,7 @@ type ListBackupPolicyJobsOptions struct { // matching the specified CRN. TargetSnapshotsCRN *string `json:"target_snapshots[].crn,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63201,7 +68229,7 @@ type ListBackupPolicyPlansOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63235,7 +68263,7 @@ type ListBareMetalServerDisksOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63269,7 +68297,7 @@ type ListBareMetalServerNetworkAttachmentsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63312,7 +68340,7 @@ type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct { // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63350,7 +68378,7 @@ type ListBareMetalServerNetworkInterfaceIpsOptions struct { // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63391,7 +68419,7 @@ type ListBareMetalServerNetworkInterfacesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63434,7 +68462,7 @@ type ListBareMetalServerProfilesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63484,7 +68512,7 @@ type ListBareMetalServersOptions struct { // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63541,12 +68569,383 @@ func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) return options } +// ListClusterNetworkInterfacesOptions : The ListClusterNetworkInterfaces options. +type ListClusterNetworkInterfacesOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// Constants associated with the ListClusterNetworkInterfacesOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListClusterNetworkInterfacesOptionsSortCreatedAtConst = "created_at" + ListClusterNetworkInterfacesOptionsSortNameConst = "name" +) + +// NewListClusterNetworkInterfacesOptions : Instantiate ListClusterNetworkInterfacesOptions +func (*VpcV1) NewListClusterNetworkInterfacesOptions(clusterNetworkID string) *ListClusterNetworkInterfacesOptions { + return &ListClusterNetworkInterfacesOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *ListClusterNetworkInterfacesOptions) SetClusterNetworkID(clusterNetworkID string) *ListClusterNetworkInterfacesOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListClusterNetworkInterfacesOptions) SetStart(start string) *ListClusterNetworkInterfacesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListClusterNetworkInterfacesOptions) SetLimit(limit int64) *ListClusterNetworkInterfacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListClusterNetworkInterfacesOptions) SetName(name string) *ListClusterNetworkInterfacesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListClusterNetworkInterfacesOptions) SetSort(sort string) *ListClusterNetworkInterfacesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListClusterNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListClusterNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListClusterNetworkProfilesOptions : The ListClusterNetworkProfiles options. +type ListClusterNetworkProfilesOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewListClusterNetworkProfilesOptions : Instantiate ListClusterNetworkProfilesOptions +func (*VpcV1) NewListClusterNetworkProfilesOptions() *ListClusterNetworkProfilesOptions { + return &ListClusterNetworkProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListClusterNetworkProfilesOptions) SetStart(start string) *ListClusterNetworkProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListClusterNetworkProfilesOptions) SetLimit(limit int64) *ListClusterNetworkProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListClusterNetworkProfilesOptions) SetHeaders(param map[string]string) *ListClusterNetworkProfilesOptions { + options.Headers = param + return options +} + +// ListClusterNetworkSubnetReservedIpsOptions : The ListClusterNetworkSubnetReservedIps options. +type ListClusterNetworkSubnetReservedIpsOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet identifier. + ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// Constants associated with the ListClusterNetworkSubnetReservedIpsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListClusterNetworkSubnetReservedIpsOptionsSortAddressConst = "address" + ListClusterNetworkSubnetReservedIpsOptionsSortCreatedAtConst = "created_at" + ListClusterNetworkSubnetReservedIpsOptionsSortNameConst = "name" +) + +// NewListClusterNetworkSubnetReservedIpsOptions : Instantiate ListClusterNetworkSubnetReservedIpsOptions +func (*VpcV1) NewListClusterNetworkSubnetReservedIpsOptions(clusterNetworkID string, clusterNetworkSubnetID string) *ListClusterNetworkSubnetReservedIpsOptions { + return &ListClusterNetworkSubnetReservedIpsOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetClusterNetworkID(clusterNetworkID string) *ListClusterNetworkSubnetReservedIpsOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID +func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *ListClusterNetworkSubnetReservedIpsOptions { + _options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetStart(start string) *ListClusterNetworkSubnetReservedIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetLimit(limit int64) *ListClusterNetworkSubnetReservedIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetName(name string) *ListClusterNetworkSubnetReservedIpsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetSort(sort string) *ListClusterNetworkSubnetReservedIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListClusterNetworkSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListClusterNetworkSubnetReservedIpsOptions { + options.Headers = param + return options +} + +// ListClusterNetworkSubnetsOptions : The ListClusterNetworkSubnets options. +type ListClusterNetworkSubnetsOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// Constants associated with the ListClusterNetworkSubnetsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListClusterNetworkSubnetsOptionsSortCreatedAtConst = "created_at" + ListClusterNetworkSubnetsOptionsSortNameConst = "name" +) + +// NewListClusterNetworkSubnetsOptions : Instantiate ListClusterNetworkSubnetsOptions +func (*VpcV1) NewListClusterNetworkSubnetsOptions(clusterNetworkID string) *ListClusterNetworkSubnetsOptions { + return &ListClusterNetworkSubnetsOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *ListClusterNetworkSubnetsOptions) SetClusterNetworkID(clusterNetworkID string) *ListClusterNetworkSubnetsOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListClusterNetworkSubnetsOptions) SetStart(start string) *ListClusterNetworkSubnetsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListClusterNetworkSubnetsOptions) SetLimit(limit int64) *ListClusterNetworkSubnetsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListClusterNetworkSubnetsOptions) SetName(name string) *ListClusterNetworkSubnetsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListClusterNetworkSubnetsOptions) SetSort(sort string) *ListClusterNetworkSubnetsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListClusterNetworkSubnetsOptions) SetHeaders(param map[string]string) *ListClusterNetworkSubnetsOptions { + options.Headers = param + return options +} + +// ListClusterNetworksOptions : The ListClusterNetworks options. +type ListClusterNetworksOptions struct { + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Filters the collection to cluster networks with a `vpc.id` property matching the specified id. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to cluster networks with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to cluster networks with a `vpc.name` property matching the specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// Constants associated with the ListClusterNetworksOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListClusterNetworksOptionsSortCreatedAtConst = "created_at" + ListClusterNetworksOptionsSortNameConst = "name" +) + +// NewListClusterNetworksOptions : Instantiate ListClusterNetworksOptions +func (*VpcV1) NewListClusterNetworksOptions() *ListClusterNetworksOptions { + return &ListClusterNetworksOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListClusterNetworksOptions) SetStart(start string) *ListClusterNetworksOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListClusterNetworksOptions) SetLimit(limit int64) *ListClusterNetworksOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListClusterNetworksOptions) SetResourceGroupID(resourceGroupID string) *ListClusterNetworksOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListClusterNetworksOptions) SetName(name string) *ListClusterNetworksOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListClusterNetworksOptions) SetSort(sort string) *ListClusterNetworksOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListClusterNetworksOptions) SetVPCID(vpcID string) *ListClusterNetworksOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListClusterNetworksOptions) SetVPCCRN(vpcCRN string) *ListClusterNetworksOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListClusterNetworksOptions) SetVPCName(vpcName string) *ListClusterNetworksOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListClusterNetworksOptions) SetHeaders(param map[string]string) *ListClusterNetworksOptions { + options.Headers = param + return options +} + // ListDedicatedHostDisksOptions : The ListDedicatedHostDisks options. type ListDedicatedHostDisksOptions struct { // The dedicated host identifier. DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63586,7 +68985,7 @@ type ListDedicatedHostGroupsOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63639,7 +69038,7 @@ type ListDedicatedHostProfilesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63686,7 +69085,7 @@ type ListDedicatedHostsOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63753,7 +69152,7 @@ type ListEndpointGatewayIpsOptions struct { // in descending order, and the value `name` sorts it by the `name` property in ascending order. Sort *string `json:"sort,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63835,7 +69234,7 @@ type ListEndpointGatewaysOptions struct { // value. AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -63943,7 +69342,7 @@ type ListFloatingIpsOptions struct { // Filters the collection to resources with a `target.resource_type` property matching the specified value. TargetResourceType *string `json:"target.resource_type,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64044,7 +69443,7 @@ type ListFlowLogCollectorsOptions struct { // Filters the collection to resources with a `target.resource_type` property matching the specified value. TargetResourceType *string `json:"target.resource_type,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64121,7 +69520,7 @@ type ListIkePoliciesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64159,7 +69558,7 @@ type ListIkePolicyConnectionsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64202,7 +69601,7 @@ type ListImageExportJobsOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64255,7 +69654,7 @@ type ListImagesOptions struct { // values. UserDataFormat []string `json:"user_data_format,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64337,12 +69736,58 @@ func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImage return options } +// ListInstanceClusterNetworkAttachmentsOptions : The ListInstanceClusterNetworkAttachments options. +type ListInstanceClusterNetworkAttachmentsOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewListInstanceClusterNetworkAttachmentsOptions : Instantiate ListInstanceClusterNetworkAttachmentsOptions +func (*VpcV1) NewListInstanceClusterNetworkAttachmentsOptions(instanceID string) *ListInstanceClusterNetworkAttachmentsOptions { + return &ListInstanceClusterNetworkAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceClusterNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceClusterNetworkAttachmentsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceClusterNetworkAttachmentsOptions) SetStart(start string) *ListInstanceClusterNetworkAttachmentsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceClusterNetworkAttachmentsOptions) SetLimit(limit int64) *ListInstanceClusterNetworkAttachmentsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceClusterNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceClusterNetworkAttachmentsOptions { + options.Headers = param + return options +} + // ListInstanceDisksOptions : The ListInstanceDisks options. type ListInstanceDisksOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64379,7 +69824,7 @@ type ListInstanceGroupManagerActionsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64435,7 +69880,7 @@ type ListInstanceGroupManagerPoliciesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64488,7 +69933,7 @@ type ListInstanceGroupManagersOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64534,7 +69979,7 @@ type ListInstanceGroupMembershipsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64577,7 +70022,7 @@ type ListInstanceGroupsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64609,7 +70054,7 @@ type ListInstanceNetworkAttachmentsOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64640,7 +70085,7 @@ type ListInstanceNetworkInterfaceFloatingIpsOptions struct { // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64684,7 +70129,7 @@ type ListInstanceNetworkInterfaceIpsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64731,7 +70176,7 @@ type ListInstanceNetworkInterfacesOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64757,7 +70202,7 @@ func (options *ListInstanceNetworkInterfacesOptions) SetHeaders(param map[string // ListInstanceProfilesOptions : The ListInstanceProfiles options. type ListInstanceProfilesOptions struct { - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64775,7 +70220,7 @@ func (options *ListInstanceProfilesOptions) SetHeaders(param map[string]string) // ListInstanceTemplatesOptions : The ListInstanceTemplates options. type ListInstanceTemplatesOptions struct { - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64795,7 +70240,7 @@ type ListInstanceVolumeAttachmentsOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64832,6 +70277,15 @@ type ListInstancesOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` + // Filters the collection to instances with a `cluster_network.id` property matching the specified identifier. + ClusterNetworkID *string `json:"cluster_network.id,omitempty"` + + // Filters the collection to instances with a `cluster_network.crn` property matching the specified CRN. + ClusterNetworkCRN *string `json:"cluster_network.crn,omitempty"` + + // Filters the collection to resources with a `cluster_network.name` property matching the exact specified name. + ClusterNetworkName *string `json:"cluster_network.name,omitempty"` + // Filters the collection to resources with a `dedicated_host.id` property matching the specified identifier. DedicatedHostID *string `json:"dedicated_host.id,omitempty"` @@ -64871,7 +70325,7 @@ type ListInstancesOptions struct { // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -64904,6 +70358,24 @@ func (_options *ListInstancesOptions) SetName(name string) *ListInstancesOptions return _options } +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *ListInstancesOptions) SetClusterNetworkID(clusterNetworkID string) *ListInstancesOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetClusterNetworkCRN : Allow user to set ClusterNetworkCRN +func (_options *ListInstancesOptions) SetClusterNetworkCRN(clusterNetworkCRN string) *ListInstancesOptions { + _options.ClusterNetworkCRN = core.StringPtr(clusterNetworkCRN) + return _options +} + +// SetClusterNetworkName : Allow user to set ClusterNetworkName +func (_options *ListInstancesOptions) SetClusterNetworkName(clusterNetworkName string) *ListInstancesOptions { + _options.ClusterNetworkName = core.StringPtr(clusterNetworkName) + return _options +} + // SetDedicatedHostID : Allow user to set DedicatedHostID func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { _options.DedicatedHostID = core.StringPtr(dedicatedHostID) @@ -64990,7 +70462,7 @@ type ListIpsecPoliciesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65028,7 +70500,7 @@ type ListIpsecPolicyConnectionsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65071,7 +70543,10 @@ type ListKeysOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Allows users to set headers on API requests. Headers map[string]string } @@ -65092,6 +70567,12 @@ func (_options *ListKeysOptions) SetLimit(limit int64) *ListKeysOptions { return _options } +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListKeysOptions) SetResourceGroupID(resourceGroupID string) *ListKeysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListKeysOptions) SetHeaders(param map[string]string) *ListKeysOptions { options.Headers = param @@ -65106,7 +70587,7 @@ type ListLoadBalancerListenerPoliciesOptions struct { // The listener identifier. ListenerID *string `json:"listener_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65147,7 +70628,7 @@ type ListLoadBalancerListenerPolicyRulesOptions struct { // The policy identifier. PolicyID *string `json:"policy_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65189,7 +70670,7 @@ type ListLoadBalancerListenersOptions struct { // The load balancer identifier. LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65220,7 +70701,7 @@ type ListLoadBalancerPoolMembersOptions struct { // The pool identifier. PoolID *string `json:"pool_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65255,7 +70736,7 @@ type ListLoadBalancerPoolsOptions struct { // The load balancer identifier. LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65286,7 +70767,7 @@ type ListLoadBalancerProfilesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65321,7 +70802,7 @@ type ListLoadBalancersOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65362,7 +70843,7 @@ type ListNetworkACLRulesOptions struct { // Filters the collection to rules with a `direction` property matching the specified value. Direction *string `json:"direction,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65421,7 +70902,7 @@ type ListNetworkAclsOptions struct { // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65471,7 +70952,7 @@ type ListNetworkInterfaceFloatingIpsOptions struct { // property in ascending order. Sort *string `json:"sort,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65530,7 +71011,7 @@ type ListOperatingSystemsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65565,7 +71046,7 @@ type ListPlacementGroupsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65606,7 +71087,7 @@ type ListPrivatePathServiceGatewayAccountPoliciesOptions struct { // Filters the collection to resources with an `account.id` property matching the specified identifier. AccountID *string `json:"account.id,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65664,7 +71145,7 @@ type ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions struct { // Filters the collection to resources with an `account.id` property matching the specified identifier. AccountID *string `json:"account.id,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65732,7 +71213,7 @@ type ListPrivatePathServiceGatewaysOptions struct { // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65776,7 +71257,7 @@ type ListPublicGatewaysOptions struct { // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65814,7 +71295,7 @@ type ListRegionZonesOptions struct { // The region name. RegionName *string `json:"region_name" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65840,7 +71321,7 @@ func (options *ListRegionZonesOptions) SetHeaders(param map[string]string) *List // ListRegionsOptions : The ListRegions options. type ListRegionsOptions struct { - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65872,7 +71353,7 @@ type ListReservationsOptions struct { // Filters the collection to resources with a `zone.name` property matching the exact specified name. ZoneName *string `json:"zone.name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65922,7 +71403,7 @@ type ListSecurityGroupRulesOptions struct { // The security group identifier. SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -65956,7 +71437,7 @@ type ListSecurityGroupTargetsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66011,7 +71492,7 @@ type ListSecurityGroupsOptions struct { // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66073,7 +71554,7 @@ type ListShareAccessorBindingsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66122,7 +71603,7 @@ type ListShareMountTargetsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66176,7 +71657,7 @@ type ListShareProfilesOptions struct { // in descending order, and the value `name` sorts it by the `name` property in ascending order. Sort *string `json:"sort,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66240,7 +71721,7 @@ type ListSharesOptions struct { // Filters the collection to file shares with a `replication_role` property matching the specified value. ReplicationRole *string `json:"replication_role,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66313,7 +71794,7 @@ type ListSnapshotClonesOptions struct { // The snapshot identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66359,7 +71840,7 @@ type ListSnapshotConsistencyGroupsOptions struct { // identifier. BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66506,7 +71987,7 @@ type ListSnapshotsOptions struct { // identifier. SnapshotConsistencyGroupCRN *string `json:"snapshot_consistency_group.crn,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66690,7 +72171,7 @@ type ListSubnetReservedIpsOptions struct { // Filters the collection to resources with a `target.resource_type` property matching the specified value. TargetResourceType *string `json:"target.resource_type,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66794,7 +72275,7 @@ type ListSubnetsOptions struct { // Filters the collection to subnets with a `routing_table.name` property matching the exact specified name. RoutingTableName *string `json:"routing_table.name,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66880,7 +72361,7 @@ type ListVirtualNetworkInterfaceIpsOptions struct { // property in ascending order. Sort *string `json:"sort,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66942,7 +72423,7 @@ type ListVirtualNetworkInterfacesOptions struct { // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -66983,7 +72464,7 @@ type ListVolumeProfilesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67047,7 +72528,7 @@ type ListVolumesOptions struct { // Filters the collection to resources with an item in the `tags` property matching the exact specified tag. Tag *string `json:"tag,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67142,7 +72623,7 @@ type ListVPCAddressPrefixesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67206,7 +72687,7 @@ type ListVPCDnsResolutionBindingsOptions struct { // identifier. AccountID *string `json:"account.id,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67294,7 +72775,7 @@ type ListVPCRoutesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67349,7 +72830,7 @@ type ListVPCRoutingTableRoutesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67405,7 +72886,7 @@ type ListVPCRoutingTablesOptions struct { // Filters the collection to routing tables with an `is_default` property matching the specified value. IsDefault *bool `json:"is_default,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67460,7 +72941,7 @@ type ListVpcsOptions struct { // Filters the collection to VPCs with a `classic_access` property matching the specified value. ClassicAccess *bool `json:"classic_access,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67507,7 +72988,7 @@ type ListVPNGatewayConnectionsLocalCIDRsOptions struct { // The VPN gateway connection identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67551,7 +73032,7 @@ type ListVPNGatewayConnectionsOptions struct { // Filters the collection to VPN gateway connections with a `status` property matching the specified value. Status *string `json:"status,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67607,7 +73088,7 @@ type ListVPNGatewayConnectionsPeerCIDRsOptions struct { // The VPN gateway connection identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67656,7 +73137,7 @@ type ListVPNGatewaysOptions struct { // Filters the collection to VPN gateways with a `mode` property matching the specified value. Mode *string `json:"mode,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67733,7 +73214,7 @@ type ListVPNServerClientsOptions struct { // in descending order. Sort *string `json:"sort,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67798,7 +73279,7 @@ type ListVPNServerRoutesOptions struct { // in descending order, and the value `name` sorts it by the `name` property in ascending order. Sort *string `json:"sort,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -67867,7 +73348,7 @@ type ListVPNServersOptions struct { // in descending order, and the value `name` sorts it by the `name` property in ascending order. Sort *string `json:"sort,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -68267,7 +73748,7 @@ func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (er // LoadBalancerCollection : LoadBalancerCollection struct type LoadBalancerCollection struct { // A link to the first page of resources. - First *LoadBalancerCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` @@ -68277,7 +73758,7 @@ type LoadBalancerCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *LoadBalancerCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -68286,7 +73767,7 @@ type LoadBalancerCollection struct { // UnmarshalLoadBalancerCollection unmarshals an instance of LoadBalancerCollection from the specified map of raw messages. func UnmarshalLoadBalancerCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -68301,7 +73782,7 @@ func UnmarshalLoadBalancerCollection(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "load_balancers-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -68330,42 +73811,6 @@ func (resp *LoadBalancerCollection) GetNextStart() (*string, error) { return start, nil } -// LoadBalancerCollectionFirst : A link to the first page of resources. -type LoadBalancerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalLoadBalancerCollectionFirst unmarshals an instance of LoadBalancerCollectionFirst from the specified map of raw messages. -func UnmarshalLoadBalancerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type LoadBalancerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalLoadBalancerCollectionNext unmarshals an instance of LoadBalancerCollectionNext from the specified map of raw messages. -func UnmarshalLoadBalancerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // LoadBalancerDns : The DNS configuration for this load balancer. // // If absent, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone @@ -68433,6 +73878,19 @@ func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interfac return } +// asPatch returns a generic map representation of the LoadBalancerDnsPatch +func (loadBalancerDnsPatch *LoadBalancerDnsPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerDnsPatch.Instance) { + _patch["instance"] = loadBalancerDnsPatch.Instance.asPatch() + } + if !core.IsNil(loadBalancerDnsPatch.Zone) { + _patch["zone"] = loadBalancerDnsPatch.Zone.asPatch() + } + + return +} + // LoadBalancerDnsPrototype : The DNS configuration for this load balancer. // // If unspecified, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone @@ -68504,6 +73962,7 @@ func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { type LoadBalancerIdentityIntf interface { isaLoadBalancerIdentity() bool + asPatch() map[string]interface{} } // UnmarshalLoadBalancerIdentity unmarshals an instance of LoadBalancerIdentity from the specified map of raw messages. @@ -68528,6 +73987,22 @@ func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interfac return } +// asPatch returns a generic map representation of the LoadBalancerIdentity +func (loadBalancerIdentity *LoadBalancerIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerIdentity.ID) { + _patch["id"] = loadBalancerIdentity.ID + } + if !core.IsNil(loadBalancerIdentity.CRN) { + _patch["crn"] = loadBalancerIdentity.CRN + } + if !core.IsNil(loadBalancerIdentity.Href) { + _patch["href"] = loadBalancerIdentity.Href + } + + return +} + // LoadBalancerListener : LoadBalancerListener struct type LoadBalancerListener struct { // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in @@ -68543,8 +74018,10 @@ type LoadBalancerListener struct { // If absent, this listener is not using a certificate instance. CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"` - // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit" validate:"required"` + // The concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected. + // + // This property will be present for load balancers in the `application` family. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` // The date and time that this listener was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -68564,8 +74041,9 @@ type LoadBalancerListener struct { // The unique identifier for this load balancer listener. ID *string `json:"id" validate:"required"` - // The idle connection timeout of the listener in seconds. This property will be present for load balancers in the - // `application` family. + // The idle connection timeout of the listener in seconds. + // + // This property will be present for load balancers in the `application` family. IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` // The policies for this listener. @@ -68748,6 +74226,7 @@ func (*LoadBalancerListenerDefaultPoolPatch) isaLoadBalancerListenerDefaultPoolP type LoadBalancerListenerDefaultPoolPatchIntf interface { isaLoadBalancerListenerDefaultPoolPatch() bool + asPatch() map[string]interface{} } // UnmarshalLoadBalancerListenerDefaultPoolPatch unmarshals an instance of LoadBalancerListenerDefaultPoolPatch from the specified map of raw messages. @@ -68767,6 +74246,19 @@ func UnmarshalLoadBalancerListenerDefaultPoolPatch(m map[string]json.RawMessage, return } +// asPatch returns a generic map representation of the LoadBalancerListenerDefaultPoolPatch +func (loadBalancerListenerDefaultPoolPatch *LoadBalancerListenerDefaultPoolPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerDefaultPoolPatch.ID) { + _patch["id"] = loadBalancerListenerDefaultPoolPatch.ID + } + if !core.IsNil(loadBalancerListenerDefaultPoolPatch.Href) { + _patch["href"] = loadBalancerListenerDefaultPoolPatch.Href + } + + return +} + // LoadBalancerListenerHTTPSRedirect : LoadBalancerListenerHTTPSRedirect struct type LoadBalancerListenerHTTPSRedirect struct { // The HTTP status code for this redirect. @@ -68834,6 +74326,22 @@ func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessag return } +// asPatch returns a generic map representation of the LoadBalancerListenerHTTPSRedirectPatch +func (loadBalancerListenerHTTPSRedirectPatch *LoadBalancerListenerHTTPSRedirectPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerHTTPSRedirectPatch.HTTPStatusCode) { + _patch["http_status_code"] = loadBalancerListenerHTTPSRedirectPatch.HTTPStatusCode + } + if !core.IsNil(loadBalancerListenerHTTPSRedirectPatch.Listener) { + _patch["listener"] = loadBalancerListenerHTTPSRedirectPatch.Listener.asPatch() + } + if !core.IsNil(loadBalancerListenerHTTPSRedirectPatch.URI) { + _patch["uri"] = loadBalancerListenerHTTPSRedirectPatch.URI + } + + return +} + // LoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerHTTPSRedirectPrototype struct type LoadBalancerListenerHTTPSRedirectPrototype struct { // The HTTP status code for this redirect. @@ -68899,6 +74407,7 @@ func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool { type LoadBalancerListenerIdentityIntf interface { isaLoadBalancerListenerIdentity() bool + asPatch() map[string]interface{} } // UnmarshalLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerIdentity from the specified map of raw messages. @@ -68918,6 +74427,19 @@ func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the LoadBalancerListenerIdentity +func (loadBalancerListenerIdentity *LoadBalancerListenerIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerIdentity.ID) { + _patch["id"] = loadBalancerListenerIdentity.ID + } + if !core.IsNil(loadBalancerListenerIdentity.Href) { + _patch["href"] = loadBalancerListenerIdentity.Href + } + + return +} + // LoadBalancerListenerPatch : LoadBalancerListenerPatch struct type LoadBalancerListenerPatch struct { // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in @@ -68932,7 +74454,9 @@ type LoadBalancerListenerPatch struct { // `protocol` of `https`. CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - // The connection limit of the listener. + // The concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected. + // + // Supported for load balancers in the `application` family. ConnectionLimit *int64 `json:"connection_limit,omitempty"` // The default pool for this listener. If `https_redirect` is set, the default pool will not @@ -68955,7 +74479,9 @@ type LoadBalancerListenerPatch struct { // Specify `null` to remove any existing https redirect. HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPatch `json:"https_redirect,omitempty"` - // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. + // The idle connection timeout of the listener in seconds. + // + // Supported for load balancers in the `application` family. IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must @@ -69076,14 +74602,38 @@ func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result int // AsPatch returns a generic map representation of the LoadBalancerListenerPatch func (loadBalancerListenerPatch *LoadBalancerListenerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerListenerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPatch.AcceptProxyProtocol) { + _patch["accept_proxy_protocol"] = loadBalancerListenerPatch.AcceptProxyProtocol } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(loadBalancerListenerPatch.CertificateInstance) { + _patch["certificate_instance"] = loadBalancerListenerPatch.CertificateInstance.asPatch() + } + if !core.IsNil(loadBalancerListenerPatch.ConnectionLimit) { + _patch["connection_limit"] = loadBalancerListenerPatch.ConnectionLimit + } + if !core.IsNil(loadBalancerListenerPatch.DefaultPool) { + _patch["default_pool"] = loadBalancerListenerPatch.DefaultPool.asPatch() } + if !core.IsNil(loadBalancerListenerPatch.HTTPSRedirect) { + _patch["https_redirect"] = loadBalancerListenerPatch.HTTPSRedirect.asPatch() + } + if !core.IsNil(loadBalancerListenerPatch.IdleConnectionTimeout) { + _patch["idle_connection_timeout"] = loadBalancerListenerPatch.IdleConnectionTimeout + } + if !core.IsNil(loadBalancerListenerPatch.Port) { + _patch["port"] = loadBalancerListenerPatch.Port + } + if !core.IsNil(loadBalancerListenerPatch.PortMax) { + _patch["port_max"] = loadBalancerListenerPatch.PortMax + } + if !core.IsNil(loadBalancerListenerPatch.PortMin) { + _patch["port_min"] = loadBalancerListenerPatch.PortMin + } + if !core.IsNil(loadBalancerListenerPatch.Protocol) { + _patch["protocol"] = loadBalancerListenerPatch.Protocol + } + return } @@ -69275,14 +74825,17 @@ func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, resu // AsPatch returns a generic map representation of the LoadBalancerListenerPolicyPatch func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerListenerPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyPatch.Name) { + _patch["name"] = loadBalancerListenerPolicyPatch.Name } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(loadBalancerListenerPolicyPatch.Priority) { + _patch["priority"] = loadBalancerListenerPolicyPatch.Priority + } + if !core.IsNil(loadBalancerListenerPolicyPatch.Target) { + _patch["target"] = loadBalancerListenerPolicyPatch.Target.asPatch() } + return } @@ -69290,9 +74843,9 @@ func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch( type LoadBalancerListenerPolicyPrototype struct { // The policy action: // - `forward`: Requests will be forwarded to the specified `target` pool - // - `https_redirect`: Requests will be redirected to the specified target listener. The - // listener must have a `protocol` of `http`, and the target listener must have a - // `protocol` of `https` + // - `https_redirect`: Requests will be redirected to the specified `target.listener`. + // This listener must have a `protocol` of `http`, and the target listener must + // have a `protocol` of `https`. // - `redirect`: Requests will be redirected to the specified `target.url` // - `reject`: Requests will be rejected with a `403` status code. Action *string `json:"action" validate:"required"` @@ -69308,19 +74861,22 @@ type LoadBalancerListenerPolicyPrototype struct { // The rule prototype objects for this policy. Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` - // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. + // - If `action` is `forward`, use `LoadBalancerPoolIdentity` to specify a pool in this + // load balancer to forward to. + // - If `action` is `https_redirect`, use + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener on this + // load balancer to redirect to. + // - If `action` is `redirect`, use `LoadBalancerListenerPolicyRedirectURLPrototype`to + // specify a URL to redirect to. Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` } // Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. // The policy action: // - `forward`: Requests will be forwarded to the specified `target` pool -// - `https_redirect`: Requests will be redirected to the specified target listener. The -// listener must have a `protocol` of `http`, and the target listener must have a -// `protocol` of `https` +// - `https_redirect`: Requests will be redirected to the specified `target.listener`. +// This listener must have a `protocol` of `http`, and the target listener must +// have a `protocol` of `https`. // - `redirect`: Requests will be redirected to the specified `target.url` // - `reject`: Requests will be rejected with a `403` status code. const ( @@ -69631,14 +75187,20 @@ func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, // AsPatch returns a generic map representation of the LoadBalancerListenerPolicyRulePatch func (loadBalancerListenerPolicyRulePatch *LoadBalancerListenerPolicyRulePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerListenerPolicyRulePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyRulePatch.Condition) { + _patch["condition"] = loadBalancerListenerPolicyRulePatch.Condition } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(loadBalancerListenerPolicyRulePatch.Field) { + _patch["field"] = loadBalancerListenerPolicyRulePatch.Field + } + if !core.IsNil(loadBalancerListenerPolicyRulePatch.Type) { + _patch["type"] = loadBalancerListenerPolicyRulePatch.Type } + if !core.IsNil(loadBalancerListenerPolicyRulePatch.Value) { + _patch["value"] = loadBalancerListenerPolicyRulePatch.Value + } + return } @@ -69914,6 +75476,7 @@ func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTarge type LoadBalancerListenerPolicyTargetPatchIntf interface { isaLoadBalancerListenerPolicyTargetPatch() bool + asPatch() map[string]interface{} } // UnmarshalLoadBalancerListenerPolicyTargetPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatch from the specified map of raw messages. @@ -69953,10 +75516,40 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage return } -// LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatch +func (loadBalancerListenerPolicyTargetPatch *LoadBalancerListenerPolicyTargetPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatch.ID) { + _patch["id"] = loadBalancerListenerPolicyTargetPatch.ID + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatch.Href) { + _patch["href"] = loadBalancerListenerPolicyTargetPatch.Href + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatch.HTTPStatusCode) { + _patch["http_status_code"] = loadBalancerListenerPolicyTargetPatch.HTTPStatusCode + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatch.Listener) { + _patch["listener"] = loadBalancerListenerPolicyTargetPatch.Listener.asPatch() + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatch.URI) { + _patch["uri"] = loadBalancerListenerPolicyTargetPatch.URI + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatch.URL) { + _patch["url"] = loadBalancerListenerPolicyTargetPatch.URL + } + + return +} + +// LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, use `LoadBalancerPoolIdentity` to specify a pool in this +// +// load balancer to forward to. +// - If `action` is `https_redirect`, use +// `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener on this +// load balancer to redirect to. +// - If `action` is `redirect`, use `LoadBalancerListenerPolicyRedirectURLPrototype`to +// specify a URL to redirect to. +// // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype @@ -70056,7 +75649,9 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // `protocol` of `https`. CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - // The connection limit of the listener. + // The concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected. + // + // This property will be present for load balancers in the `application` family. ConnectionLimit *int64 `json:"connection_limit,omitempty"` // The default pool for this listener. If `https_redirect` is specified, @@ -70078,7 +75673,9 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // listener must have a `protocol` of `https`. HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` - // The idle connection timeout of the listener in seconds. Supported for load balancers in the `application` family. + // The idle connection timeout of the listener in seconds. + // + // Supported for load balancers in the `application` family. IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must @@ -70298,6 +75895,16 @@ func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, res return } +// asPatch returns a generic map representation of the LoadBalancerLoggingDatapathPatch +func (loadBalancerLoggingDatapathPatch *LoadBalancerLoggingDatapathPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerLoggingDatapathPatch.Active) { + _patch["active"] = loadBalancerLoggingDatapathPatch.Active + } + + return +} + // LoadBalancerLoggingDatapathPrototype : The datapath logging configuration for this load balancer. type LoadBalancerLoggingDatapathPrototype struct { // Indicates whether datapath logging will be active for this load balancer. @@ -70334,6 +75941,16 @@ func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the LoadBalancerLoggingPatch +func (loadBalancerLoggingPatch *LoadBalancerLoggingPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerLoggingPatch.Datapath) { + _patch["datapath"] = loadBalancerLoggingPatch.Datapath.asPatch() + } + + return +} + // LoadBalancerLoggingPrototype : LoadBalancerLoggingPrototype struct type LoadBalancerLoggingPrototype struct { // The datapath logging configuration for this load balancer. @@ -70410,14 +76027,24 @@ func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{} // AsPatch returns a generic map representation of the LoadBalancerPatch func (loadBalancerPatch *LoadBalancerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPatch.Dns) { + _patch["dns"] = loadBalancerPatch.Dns.asPatch() } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(loadBalancerPatch.Logging) { + _patch["logging"] = loadBalancerPatch.Logging.asPatch() + } + if !core.IsNil(loadBalancerPatch.Name) { + _patch["name"] = loadBalancerPatch.Name + } + if !core.IsNil(loadBalancerPatch.Subnets) { + var subnetsPatches []map[string]interface{} + for _, subnets := range loadBalancerPatch.Subnets { + subnetsPatches = append(subnetsPatches, subnets.asPatch()) + } + _patch["subnets"] = subnetsPatches } + return } @@ -70639,11 +76266,6 @@ type LoadBalancerPoolHealthMonitor struct { // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). // // If `type` is `tcp`, this property will be absent. - URL interface{} `json:"url,omitempty"` - - // The health check URL path. If specified, `type` must be `http` or `https`. - // - // Must be in the format of an [origin-form request target](https://tools.ietf.org/html/rfc7230#section-5.3.1). URLPath *string `json:"url_path,omitempty"` } @@ -70686,11 +76308,6 @@ func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) if err != nil { err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) @@ -70787,6 +76404,31 @@ func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, r return } +// asPatch returns a generic map representation of the LoadBalancerPoolHealthMonitorPatch +func (loadBalancerPoolHealthMonitorPatch *LoadBalancerPoolHealthMonitorPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolHealthMonitorPatch.Delay) { + _patch["delay"] = loadBalancerPoolHealthMonitorPatch.Delay + } + if !core.IsNil(loadBalancerPoolHealthMonitorPatch.MaxRetries) { + _patch["max_retries"] = loadBalancerPoolHealthMonitorPatch.MaxRetries + } + if !core.IsNil(loadBalancerPoolHealthMonitorPatch.Port) { + _patch["port"] = loadBalancerPoolHealthMonitorPatch.Port + } + if !core.IsNil(loadBalancerPoolHealthMonitorPatch.Timeout) { + _patch["timeout"] = loadBalancerPoolHealthMonitorPatch.Timeout + } + if !core.IsNil(loadBalancerPoolHealthMonitorPatch.Type) { + _patch["type"] = loadBalancerPoolHealthMonitorPatch.Type + } + if !core.IsNil(loadBalancerPoolHealthMonitorPatch.URLPath) { + _patch["url_path"] = loadBalancerPoolHealthMonitorPatch.URLPath + } + + return +} + // LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct type LoadBalancerPoolHealthMonitorPrototype struct { // The seconds to wait between health checks. Must be greater than `timeout`. @@ -70890,6 +76532,7 @@ func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { type LoadBalancerPoolIdentityIntf interface { isaLoadBalancerPoolIdentity() bool + asPatch() map[string]interface{} } // UnmarshalLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerPoolIdentity from the specified map of raw messages. @@ -70909,6 +76552,19 @@ func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the LoadBalancerPoolIdentity +func (loadBalancerPoolIdentity *LoadBalancerPoolIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolIdentity.ID) { + _patch["id"] = loadBalancerPoolIdentity.ID + } + if !core.IsNil(loadBalancerPoolIdentity.Href) { + _patch["href"] = loadBalancerPoolIdentity.Href + } + + return +} + // LoadBalancerPoolIdentityByName : LoadBalancerPoolIdentityByName struct type LoadBalancerPoolIdentityByName struct { // The name for this load balancer pool. The name is unique across all pools for the load balancer. @@ -71119,14 +76775,17 @@ func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result i // AsPatch returns a generic map representation of the LoadBalancerPoolMemberPatch func (loadBalancerPoolMemberPatch *LoadBalancerPoolMemberPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerPoolMemberPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberPatch.Port) { + _patch["port"] = loadBalancerPoolMemberPatch.Port } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(loadBalancerPoolMemberPatch.Target) { + _patch["target"] = loadBalancerPoolMemberPatch.Target.asPatch() } + if !core.IsNil(loadBalancerPoolMemberPatch.Weight) { + _patch["weight"] = loadBalancerPoolMemberPatch.Weight + } + return } @@ -71328,6 +76987,7 @@ func (*LoadBalancerPoolMemberTargetPrototype) isaLoadBalancerPoolMemberTargetPro type LoadBalancerPoolMemberTargetPrototypeIntf interface { isaLoadBalancerPoolMemberTargetPrototype() bool + asPatch() map[string]interface{} } // UnmarshalLoadBalancerPoolMemberTargetPrototype unmarshals an instance of LoadBalancerPoolMemberTargetPrototype from the specified map of raw messages. @@ -71357,9 +77017,29 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage return } +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototype +func (loadBalancerPoolMemberTargetPrototype *LoadBalancerPoolMemberTargetPrototype) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototype.ID) { + _patch["id"] = loadBalancerPoolMemberTargetPrototype.ID + } + if !core.IsNil(loadBalancerPoolMemberTargetPrototype.CRN) { + _patch["crn"] = loadBalancerPoolMemberTargetPrototype.CRN + } + if !core.IsNil(loadBalancerPoolMemberTargetPrototype.Href) { + _patch["href"] = loadBalancerPoolMemberTargetPrototype.Href + } + if !core.IsNil(loadBalancerPoolMemberTargetPrototype.Address) { + _patch["address"] = loadBalancerPoolMemberTargetPrototype.Address + } + + return +} + // LoadBalancerPoolPatch : LoadBalancerPoolPatch struct type LoadBalancerPoolPatch struct { - // The load balancing algorithm. + // The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have + // `availability` with value `subnet` in the profile. Algorithm *string `json:"algorithm,omitempty"` // The health monitor of this pool. @@ -71391,7 +77071,8 @@ type LoadBalancerPoolPatch struct { } // Constants associated with the LoadBalancerPoolPatch.Algorithm property. -// The load balancing algorithm. +// The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have +// `availability` with value `subnet` in the profile. const ( LoadBalancerPoolPatchAlgorithmLeastConnectionsConst = "least_connections" LoadBalancerPoolPatchAlgorithmRoundRobinConst = "round_robin" @@ -71466,14 +77147,26 @@ func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interfa // AsPatch returns a generic map representation of the LoadBalancerPoolPatch func (loadBalancerPoolPatch *LoadBalancerPoolPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(loadBalancerPoolPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolPatch.Algorithm) { + _patch["algorithm"] = loadBalancerPoolPatch.Algorithm } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(loadBalancerPoolPatch.HealthMonitor) { + _patch["health_monitor"] = loadBalancerPoolPatch.HealthMonitor.asPatch() + } + if !core.IsNil(loadBalancerPoolPatch.Name) { + _patch["name"] = loadBalancerPoolPatch.Name + } + if !core.IsNil(loadBalancerPoolPatch.Protocol) { + _patch["protocol"] = loadBalancerPoolPatch.Protocol } + if !core.IsNil(loadBalancerPoolPatch.ProxyProtocol) { + _patch["proxy_protocol"] = loadBalancerPoolPatch.ProxyProtocol + } + if !core.IsNil(loadBalancerPoolPatch.SessionPersistence) { + _patch["session_persistence"] = loadBalancerPoolPatch.SessionPersistence.asPatch() + } + return } @@ -71728,6 +77421,19 @@ func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessa return } +// asPatch returns a generic map representation of the LoadBalancerPoolSessionPersistencePatch +func (loadBalancerPoolSessionPersistencePatch *LoadBalancerPoolSessionPersistencePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolSessionPersistencePatch.CookieName) { + _patch["cookie_name"] = loadBalancerPoolSessionPersistencePatch.CookieName + } + if !core.IsNil(loadBalancerPoolSessionPersistencePatch.Type) { + _patch["type"] = loadBalancerPoolSessionPersistencePatch.Type + } + + return +} + // LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct type LoadBalancerPoolSessionPersistencePrototype struct { // The session persistence cookie name. Names starting with `IBM` are not allowed. @@ -71997,14 +77703,14 @@ func UnmarshalLoadBalancerProfileAvailability(m map[string]json.RawMessage, resu // LoadBalancerProfileCollection : LoadBalancerProfileCollection struct type LoadBalancerProfileCollection struct { // A link to the first page of resources. - First *LoadBalancerProfileCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *LoadBalancerProfileCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of load balancer profiles. Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` @@ -72016,7 +77722,7 @@ type LoadBalancerProfileCollection struct { // UnmarshalLoadBalancerProfileCollection unmarshals an instance of LoadBalancerProfileCollection from the specified map of raw messages. func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerProfileCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -72026,7 +77732,7 @@ func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerProfileCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -72060,42 +77766,6 @@ func (resp *LoadBalancerProfileCollection) GetNextStart() (*string, error) { return start, nil } -// LoadBalancerProfileCollectionFirst : A link to the first page of resources. -type LoadBalancerProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalLoadBalancerProfileCollectionFirst unmarshals an instance of LoadBalancerProfileCollectionFirst from the specified map of raw messages. -func UnmarshalLoadBalancerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type LoadBalancerProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalLoadBalancerProfileCollectionNext unmarshals an instance of LoadBalancerProfileCollectionNext from the specified map of raw messages. -func UnmarshalLoadBalancerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // LoadBalancerProfileIdentity : Identifies a load balancer profile by a unique property. // Models which "extend" this model: // - LoadBalancerProfileIdentityByName @@ -72619,7 +78289,7 @@ func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err // NetworkACLCollection : NetworkACLCollection struct type NetworkACLCollection struct { // A link to the first page of resources. - First *NetworkACLCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` @@ -72629,7 +78299,7 @@ type NetworkACLCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *NetworkACLCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -72638,7 +78308,7 @@ type NetworkACLCollection struct { // UnmarshalNetworkACLCollection unmarshals an instance of NetworkACLCollection from the specified map of raw messages. func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(NetworkACLCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -72653,7 +78323,7 @@ func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "network_acls-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -72682,42 +78352,6 @@ func (resp *NetworkACLCollection) GetNextStart() (*string, error) { return start, nil } -// NetworkACLCollectionFirst : A link to the first page of resources. -type NetworkACLCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalNetworkACLCollectionFirst unmarshals an instance of NetworkACLCollectionFirst from the specified map of raw messages. -func UnmarshalNetworkACLCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type NetworkACLCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalNetworkACLCollectionNext unmarshals an instance of NetworkACLCollectionNext from the specified map of raw messages. -func UnmarshalNetworkACLCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // NetworkACLIdentity : Identifies a network ACL by a unique property. // Models which "extend" this model: // - NetworkACLIdentityByID @@ -72740,6 +78374,7 @@ func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { type NetworkACLIdentityIntf interface { isaNetworkACLIdentity() bool + asPatch() map[string]interface{} } // UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. @@ -72764,6 +78399,22 @@ func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{ return } +// asPatch returns a generic map representation of the NetworkACLIdentity +func (networkACLIdentity *NetworkACLIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLIdentity.ID) { + _patch["id"] = networkACLIdentity.ID + } + if !core.IsNil(networkACLIdentity.CRN) { + _patch["crn"] = networkACLIdentity.CRN + } + if !core.IsNil(networkACLIdentity.Href) { + _patch["href"] = networkACLIdentity.Href + } + + return +} + // NetworkACLPatch : NetworkACLPatch struct type NetworkACLPatch struct { // The name for this network ACL. The name must not be used by another network ACL for the VPC. @@ -72784,14 +78435,11 @@ func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) // AsPatch returns a generic map representation of the NetworkACLPatch func (networkACLPatch *NetworkACLPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(networkACLPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(networkACLPatch.Name) { + _patch["name"] = networkACLPatch.Name } + return } @@ -73070,6 +78718,7 @@ func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { type NetworkACLRuleBeforePatchIntf interface { isaNetworkACLRuleBeforePatch() bool + asPatch() map[string]interface{} } // UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. @@ -73089,6 +78738,19 @@ func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result int return } +// asPatch returns a generic map representation of the NetworkACLRuleBeforePatch +func (networkACLRuleBeforePatch *NetworkACLRuleBeforePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLRuleBeforePatch.ID) { + _patch["id"] = networkACLRuleBeforePatch.ID + } + if !core.IsNil(networkACLRuleBeforePatch.Href) { + _patch["href"] = networkACLRuleBeforePatch.Href + } + + return +} + // NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. // // If unspecified, this rule will be inserted after all existing rules. @@ -73131,14 +78793,14 @@ func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result // NetworkACLRuleCollection : NetworkACLRuleCollection struct type NetworkACLRuleCollection struct { // A link to the first page of resources. - First *NetworkACLRuleCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *NetworkACLRuleCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of ordered rules (sorted based on the `before` property) for the network ACL. Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` @@ -73150,7 +78812,7 @@ type NetworkACLRuleCollection struct { // UnmarshalNetworkACLRuleCollection unmarshals an instance of NetworkACLRuleCollection from the specified map of raw messages. func UnmarshalNetworkACLRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(NetworkACLRuleCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLRuleCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -73160,7 +78822,7 @@ func UnmarshalNetworkACLRuleCollection(m map[string]json.RawMessage, result inte err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLRuleCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -73194,42 +78856,6 @@ func (resp *NetworkACLRuleCollection) GetNextStart() (*string, error) { return start, nil } -// NetworkACLRuleCollectionFirst : A link to the first page of resources. -type NetworkACLRuleCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalNetworkACLRuleCollectionFirst unmarshals an instance of NetworkACLRuleCollectionFirst from the specified map of raw messages. -func UnmarshalNetworkACLRuleCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type NetworkACLRuleCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalNetworkACLRuleCollectionNext unmarshals an instance of NetworkACLRuleCollectionNext from the specified map of raw messages. -func UnmarshalNetworkACLRuleCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // NetworkACLRuleItem : NetworkACLRuleItem struct // Models which "extend" this model: // - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp @@ -73516,14 +79142,47 @@ func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface // AsPatch returns a generic map representation of the NetworkACLRulePatch func (networkACLRulePatch *NetworkACLRulePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(networkACLRulePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(networkACLRulePatch.Action) { + _patch["action"] = networkACLRulePatch.Action } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(networkACLRulePatch.Before) { + _patch["before"] = networkACLRulePatch.Before.asPatch() + } + if !core.IsNil(networkACLRulePatch.Code) { + _patch["code"] = networkACLRulePatch.Code + } + if !core.IsNil(networkACLRulePatch.Destination) { + _patch["destination"] = networkACLRulePatch.Destination + } + if !core.IsNil(networkACLRulePatch.DestinationPortMax) { + _patch["destination_port_max"] = networkACLRulePatch.DestinationPortMax + } + if !core.IsNil(networkACLRulePatch.DestinationPortMin) { + _patch["destination_port_min"] = networkACLRulePatch.DestinationPortMin + } + if !core.IsNil(networkACLRulePatch.Direction) { + _patch["direction"] = networkACLRulePatch.Direction + } + if !core.IsNil(networkACLRulePatch.Name) { + _patch["name"] = networkACLRulePatch.Name + } + if !core.IsNil(networkACLRulePatch.Protocol) { + _patch["protocol"] = networkACLRulePatch.Protocol + } + if !core.IsNil(networkACLRulePatch.Source) { + _patch["source"] = networkACLRulePatch.Source } + if !core.IsNil(networkACLRulePatch.SourcePortMax) { + _patch["source_port_max"] = networkACLRulePatch.SourcePortMax + } + if !core.IsNil(networkACLRulePatch.SourcePortMin) { + _patch["source_port_min"] = networkACLRulePatch.SourcePortMin + } + if !core.IsNil(networkACLRulePatch.Type) { + _patch["type"] = networkACLRulePatch.Type + } + return } @@ -74286,14 +79945,14 @@ func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interfa // AsPatch returns a generic map representation of the NetworkInterfacePatch func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(networkInterfacePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(networkInterfacePatch.AllowIPSpoofing) { + _patch["allow_ip_spoofing"] = networkInterfacePatch.AllowIPSpoofing } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(networkInterfacePatch.Name) { + _patch["name"] = networkInterfacePatch.Name } + return } @@ -74394,7 +80053,7 @@ type ObsoleteImageOptions struct { // The image identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -74526,14 +80185,14 @@ func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) // OperatingSystemCollection : OperatingSystemCollection struct type OperatingSystemCollection struct { // A link to the first page of resources. - First *OperatingSystemCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *OperatingSystemCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of operating systems. OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` @@ -74545,7 +80204,7 @@ type OperatingSystemCollection struct { // UnmarshalOperatingSystemCollection unmarshals an instance of OperatingSystemCollection from the specified map of raw messages. func UnmarshalOperatingSystemCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(OperatingSystemCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalOperatingSystemCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -74555,7 +80214,7 @@ func UnmarshalOperatingSystemCollection(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalOperatingSystemCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -74589,42 +80248,6 @@ func (resp *OperatingSystemCollection) GetNextStart() (*string, error) { return start, nil } -// OperatingSystemCollectionFirst : A link to the first page of resources. -type OperatingSystemCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalOperatingSystemCollectionFirst unmarshals an instance of OperatingSystemCollectionFirst from the specified map of raw messages. -func UnmarshalOperatingSystemCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// OperatingSystemCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type OperatingSystemCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalOperatingSystemCollectionNext unmarshals an instance of OperatingSystemCollectionNext from the specified map of raw messages. -func UnmarshalOperatingSystemCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // OperatingSystemIdentity : Identifies an operating system by a unique property. // Models which "extend" this model: // - OperatingSystemIdentityByName @@ -74662,6 +80285,24 @@ func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result inter return } +// PageLink : PageLink struct +type PageLink struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalPageLink unmarshals an instance of PageLink from the specified map of raw messages. +func UnmarshalPageLink(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PageLink) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions : The PermitPrivatePathServiceGatewayEndpointGatewayBinding options. type PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions struct { // The private path service gateway identifier. @@ -74685,7 +80326,7 @@ type PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions struct { // - All `pending` endpoint gateway bindings for the account will remain `pending`. SetAccountPolicy *bool `json:"set_account_policy,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -74841,14 +80482,14 @@ func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) ( // PlacementGroupCollection : PlacementGroupCollection struct type PlacementGroupCollection struct { // A link to the first page of resources. - First *PlacementGroupCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *PlacementGroupCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of placement groups. PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` @@ -74860,7 +80501,7 @@ type PlacementGroupCollection struct { // UnmarshalPlacementGroupCollection unmarshals an instance of PlacementGroupCollection from the specified map of raw messages. func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(PlacementGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPlacementGroupCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -74870,7 +80511,7 @@ func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result inte err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPlacementGroupCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -74904,42 +80545,6 @@ func (resp *PlacementGroupCollection) GetNextStart() (*string, error) { return start, nil } -// PlacementGroupCollectionFirst : A link to the first page of resources. -type PlacementGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPlacementGroupCollectionFirst unmarshals an instance of PlacementGroupCollectionFirst from the specified map of raw messages. -func UnmarshalPlacementGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PlacementGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type PlacementGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPlacementGroupCollectionNext unmarshals an instance of PlacementGroupCollectionNext from the specified map of raw messages. -func UnmarshalPlacementGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // PlacementGroupPatch : PlacementGroupPatch struct type PlacementGroupPatch struct { // The name for this placement group. The name must not be used by another placement group in the region. @@ -74960,14 +80565,11 @@ func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface // AsPatch returns a generic map representation of the PlacementGroupPatch func (placementGroupPatch *PlacementGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(placementGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(placementGroupPatch.Name) { + _patch["name"] = placementGroupPatch.Name } + return } @@ -75245,14 +80847,14 @@ type PrivatePathServiceGatewayAccountPolicyCollection struct { AccountPolicies []PrivatePathServiceGatewayAccountPolicy `json:"account_policies" validate:"required"` // A link to the first page of resources. - First *PrivatePathServiceGatewayAccountPolicyCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *PrivatePathServiceGatewayAccountPolicyCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -75266,7 +80868,7 @@ func UnmarshalPrivatePathServiceGatewayAccountPolicyCollection(m map[string]json err = core.SDKErrorf(err, "", "account_policies-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPrivatePathServiceGatewayAccountPolicyCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -75276,7 +80878,7 @@ func UnmarshalPrivatePathServiceGatewayAccountPolicyCollection(m map[string]json err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPrivatePathServiceGatewayAccountPolicyCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -75305,42 +80907,6 @@ func (resp *PrivatePathServiceGatewayAccountPolicyCollection) GetNextStart() (*s return start, nil } -// PrivatePathServiceGatewayAccountPolicyCollectionFirst : A link to the first page of resources. -type PrivatePathServiceGatewayAccountPolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPrivatePathServiceGatewayAccountPolicyCollectionFirst unmarshals an instance of PrivatePathServiceGatewayAccountPolicyCollectionFirst from the specified map of raw messages. -func UnmarshalPrivatePathServiceGatewayAccountPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrivatePathServiceGatewayAccountPolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PrivatePathServiceGatewayAccountPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type PrivatePathServiceGatewayAccountPolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPrivatePathServiceGatewayAccountPolicyCollectionNext unmarshals an instance of PrivatePathServiceGatewayAccountPolicyCollectionNext from the specified map of raw messages. -func UnmarshalPrivatePathServiceGatewayAccountPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrivatePathServiceGatewayAccountPolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // PrivatePathServiceGatewayAccountPolicyPatch : PrivatePathServiceGatewayAccountPolicyPatch struct type PrivatePathServiceGatewayAccountPolicyPatch struct { // The access policy for the account. Updating the access policy only affects pending and future endpoint gateway @@ -75391,28 +80957,25 @@ func UnmarshalPrivatePathServiceGatewayAccountPolicyPatch(m map[string]json.RawM // AsPatch returns a generic map representation of the PrivatePathServiceGatewayAccountPolicyPatch func (privatePathServiceGatewayAccountPolicyPatch *PrivatePathServiceGatewayAccountPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(privatePathServiceGatewayAccountPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(privatePathServiceGatewayAccountPolicyPatch.AccessPolicy) { + _patch["access_policy"] = privatePathServiceGatewayAccountPolicyPatch.AccessPolicy } + return } // PrivatePathServiceGatewayCollection : PrivatePathServiceGatewayCollection struct type PrivatePathServiceGatewayCollection struct { // A link to the first page of resources. - First *PrivatePathServiceGatewayCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *PrivatePathServiceGatewayCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of private path service gateways. PrivatePathServiceGateways []PrivatePathServiceGateway `json:"private_path_service_gateways" validate:"required"` @@ -75424,7 +80987,7 @@ type PrivatePathServiceGatewayCollection struct { // UnmarshalPrivatePathServiceGatewayCollection unmarshals an instance of PrivatePathServiceGatewayCollection from the specified map of raw messages. func UnmarshalPrivatePathServiceGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(PrivatePathServiceGatewayCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPrivatePathServiceGatewayCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -75434,7 +80997,7 @@ func UnmarshalPrivatePathServiceGatewayCollection(m map[string]json.RawMessage, err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPrivatePathServiceGatewayCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -75468,42 +81031,6 @@ func (resp *PrivatePathServiceGatewayCollection) GetNextStart() (*string, error) return start, nil } -// PrivatePathServiceGatewayCollectionFirst : A link to the first page of resources. -type PrivatePathServiceGatewayCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPrivatePathServiceGatewayCollectionFirst unmarshals an instance of PrivatePathServiceGatewayCollectionFirst from the specified map of raw messages. -func UnmarshalPrivatePathServiceGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrivatePathServiceGatewayCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PrivatePathServiceGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type PrivatePathServiceGatewayCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPrivatePathServiceGatewayCollectionNext unmarshals an instance of PrivatePathServiceGatewayCollectionNext from the specified map of raw messages. -func UnmarshalPrivatePathServiceGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrivatePathServiceGatewayCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // PrivatePathServiceGatewayEndpointGatewayBinding : PrivatePathServiceGatewayEndpointGatewayBinding struct type PrivatePathServiceGatewayEndpointGatewayBinding struct { // The account that created the endpoint gateway. @@ -75636,14 +81163,14 @@ type PrivatePathServiceGatewayEndpointGatewayBindingCollection struct { EndpointGatewayBindings []PrivatePathServiceGatewayEndpointGatewayBinding `json:"endpoint_gateway_bindings" validate:"required"` // A link to the first page of resources. - First *PrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *PrivatePathServiceGatewayEndpointGatewayBindingCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -75657,7 +81184,7 @@ func UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection(m map[st err = core.SDKErrorf(err, "", "endpoint_gateway_bindings-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -75667,7 +81194,7 @@ func UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection(m map[st err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -75696,42 +81223,6 @@ func (resp *PrivatePathServiceGatewayEndpointGatewayBindingCollection) GetNextSt return start, nil } -// PrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst : A link to the first page of resources. -type PrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst unmarshals an instance of PrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst from the specified map of raw messages. -func UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PrivatePathServiceGatewayEndpointGatewayBindingCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type PrivatePathServiceGatewayEndpointGatewayBindingCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollectionNext unmarshals an instance of PrivatePathServiceGatewayEndpointGatewayBindingCollectionNext from the specified map of raw messages. -func UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrivatePathServiceGatewayEndpointGatewayBindingCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // PrivatePathServiceGatewayPatch : PrivatePathServiceGatewayPatch struct type PrivatePathServiceGatewayPatch struct { // The policy to use for bindings from accounts without an explicit account policy. @@ -75792,14 +81283,20 @@ func UnmarshalPrivatePathServiceGatewayPatch(m map[string]json.RawMessage, resul // AsPatch returns a generic map representation of the PrivatePathServiceGatewayPatch func (privatePathServiceGatewayPatch *PrivatePathServiceGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(privatePathServiceGatewayPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(privatePathServiceGatewayPatch.DefaultAccessPolicy) { + _patch["default_access_policy"] = privatePathServiceGatewayPatch.DefaultAccessPolicy } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(privatePathServiceGatewayPatch.LoadBalancer) { + _patch["load_balancer"] = privatePathServiceGatewayPatch.LoadBalancer.asPatch() } + if !core.IsNil(privatePathServiceGatewayPatch.Name) { + _patch["name"] = privatePathServiceGatewayPatch.Name + } + if !core.IsNil(privatePathServiceGatewayPatch.ZonalAffinity) { + _patch["zonal_affinity"] = privatePathServiceGatewayPatch.ZonalAffinity + } + return } @@ -75948,14 +81445,14 @@ func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (e // PublicGatewayCollection : PublicGatewayCollection struct type PublicGatewayCollection struct { // A link to the first page of resources. - First *PublicGatewayCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *PublicGatewayCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of public gateways. PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` @@ -75967,7 +81464,7 @@ type PublicGatewayCollection struct { // UnmarshalPublicGatewayCollection unmarshals an instance of PublicGatewayCollection from the specified map of raw messages. func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(PublicGatewayCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPublicGatewayCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -75977,7 +81474,7 @@ func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPublicGatewayCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -76011,42 +81508,6 @@ func (resp *PublicGatewayCollection) GetNextStart() (*string, error) { return start, nil } -// PublicGatewayCollectionFirst : A link to the first page of resources. -type PublicGatewayCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPublicGatewayCollectionFirst unmarshals an instance of PublicGatewayCollectionFirst from the specified map of raw messages. -func UnmarshalPublicGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type PublicGatewayCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalPublicGatewayCollectionNext unmarshals an instance of PublicGatewayCollectionNext from the specified map of raw messages. -func UnmarshalPublicGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // PublicGatewayFloatingIP : The floating IP bound to this public gateway. type PublicGatewayFloatingIP struct { // The globally unique IP address. @@ -76243,14 +81704,11 @@ func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{ // AsPatch returns a generic map representation of the PublicGatewayPatch func (publicGatewayPatch *PublicGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(publicGatewayPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(publicGatewayPatch.Name) { + _patch["name"] = publicGatewayPatch.Name } + return } @@ -76324,7 +81782,7 @@ type PublishPrivatePathServiceGatewayOptions struct { // The private path service gateway identifier. PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76438,6 +81896,7 @@ func (*RegionIdentity) isaRegionIdentity() bool { type RegionIdentityIntf interface { isaRegionIdentity() bool + asPatch() map[string]interface{} } // UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages. @@ -76457,6 +81916,19 @@ func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) ( return } +// asPatch returns a generic map representation of the RegionIdentity +func (regionIdentity *RegionIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(regionIdentity.Name) { + _patch["name"] = regionIdentity.Name + } + if !core.IsNil(regionIdentity.Href) { + _patch["href"] = regionIdentity.Href + } + + return +} + // RegionReference : RegionReference struct type RegionReference struct { // The URL for this region. @@ -76494,7 +81966,7 @@ type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The floating IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76539,7 +82011,7 @@ type RemoveEndpointGatewayIPOptions struct { // The reserved IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76580,7 +82052,7 @@ type RemoveInstanceNetworkInterfaceFloatingIPOptions struct { // The floating IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76625,7 +82097,7 @@ type RemoveNetworkInterfaceFloatingIPOptions struct { // The floating IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76663,7 +82135,7 @@ type RemoveVirtualNetworkInterfaceIPOptions struct { // The reserved IP identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76704,7 +82176,7 @@ type RemoveVPNGatewayConnectionsLocalCIDROptions struct { // The IP address range in CIDR block notation. CIDR *string `json:"cidr" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76752,7 +82224,7 @@ type RemoveVPNGatewayConnectionsPeerCIDROptions struct { // The IP address range in CIDR block notation. CIDR *string `json:"cidr" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76811,7 +82283,7 @@ type ReplaceBareMetalServerInitializationOptions struct { // If unspecified, no user data will be made available. UserData *string `json:"user_data,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76865,7 +82337,7 @@ type ReplaceLoadBalancerPoolMembersOptions struct { // The member prototype objects for this pool. Members []LoadBalancerPoolMemberPrototype `json:"members" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76910,7 +82382,7 @@ type ReplaceSubnetNetworkACLOptions struct { // The network ACL identity. NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -76948,7 +82420,7 @@ type ReplaceSubnetRoutingTableOptions struct { // The routing table identity. RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -77175,8 +82647,9 @@ type ReservationCapacity struct { // - `allocating`: The capacity reservation is being allocated for use // - `allocated`: The total capacity of the reservation has been allocated for use // - `degraded`: The capacity reservation has been allocated for use, but some of the - // capacity is not available. - // See https://cloud.ibm.com/docs/vpc?topic=vpc-capacity-status for more information. + // capacity is not available. See [capacity status + // reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons) + // for more information. // - `unallocated`: The capacity reservation is not allocated for use // // The enumerated values for this property may @@ -77195,8 +82668,9 @@ type ReservationCapacity struct { // - `allocating`: The capacity reservation is being allocated for use // - `allocated`: The total capacity of the reservation has been allocated for use // - `degraded`: The capacity reservation has been allocated for use, but some of the -// capacity is not available. -// See https://cloud.ibm.com/docs/vpc?topic=vpc-capacity-status for more information. +// capacity is not available. See [capacity status +// reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons) +// for more information. // - `unallocated`: The capacity reservation is not allocated for use // // The enumerated values for this property may @@ -77260,6 +82734,16 @@ func UnmarshalReservationCapacityPatch(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the ReservationCapacityPatch +func (reservationCapacityPatch *ReservationCapacityPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(reservationCapacityPatch.Total) { + _patch["total"] = reservationCapacityPatch.Total + } + + return +} + // ReservationCapacityPrototype : The capacity reservation configuration to use. type ReservationCapacityPrototype struct { // The total amount to use for this capacity reservation. @@ -77293,14 +82777,14 @@ func UnmarshalReservationCapacityPrototype(m map[string]json.RawMessage, result // ReservationCollection : ReservationCollection struct type ReservationCollection struct { // A link to the first page of resources. - First *ReservationCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ReservationCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of reservations. Reservations []Reservation `json:"reservations" validate:"required"` @@ -77312,7 +82796,7 @@ type ReservationCollection struct { // UnmarshalReservationCollection unmarshals an instance of ReservationCollection from the specified map of raw messages. func UnmarshalReservationCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservationCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservationCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -77322,7 +82806,7 @@ func UnmarshalReservationCollection(m map[string]json.RawMessage, result interfa err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservationCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -77356,42 +82840,6 @@ func (resp *ReservationCollection) GetNextStart() (*string, error) { return start, nil } -// ReservationCollectionFirst : A link to the first page of resources. -type ReservationCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservationCollectionFirst unmarshals an instance of ReservationCollectionFirst from the specified map of raw messages. -func UnmarshalReservationCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservationCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservationCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservationCollectionNext unmarshals an instance of ReservationCollectionNext from the specified map of raw messages. -func UnmarshalReservationCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ReservationCommittedUse : The committed use reservation configuration. type ReservationCommittedUse struct { // The expiration date and time for this committed use reservation. @@ -77497,6 +82945,19 @@ func UnmarshalReservationCommittedUsePatch(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the ReservationCommittedUsePatch +func (reservationCommittedUsePatch *ReservationCommittedUsePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(reservationCommittedUsePatch.ExpirationPolicy) { + _patch["expiration_policy"] = reservationCommittedUsePatch.ExpirationPolicy + } + if !core.IsNil(reservationCommittedUsePatch.Term) { + _patch["term"] = reservationCommittedUsePatch.Term + } + + return +} + // ReservationCommittedUsePrototype : ReservationCommittedUsePrototype struct type ReservationCommittedUsePrototype struct { // The policy to apply when the committed use term expires: @@ -77574,6 +83035,7 @@ func (*ReservationIdentity) isaReservationIdentity() bool { type ReservationIdentityIntf interface { isaReservationIdentity() bool + asPatch() map[string]interface{} } // UnmarshalReservationIdentity unmarshals an instance of ReservationIdentity from the specified map of raw messages. @@ -77598,6 +83060,22 @@ func UnmarshalReservationIdentity(m map[string]json.RawMessage, result interface return } +// asPatch returns a generic map representation of the ReservationIdentity +func (reservationIdentity *ReservationIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(reservationIdentity.ID) { + _patch["id"] = reservationIdentity.ID + } + if !core.IsNil(reservationIdentity.CRN) { + _patch["crn"] = reservationIdentity.CRN + } + if !core.IsNil(reservationIdentity.Href) { + _patch["href"] = reservationIdentity.Href + } + + return +} + // ReservationPatch : ReservationPatch struct type ReservationPatch struct { // The capacity reservation configuration to use. @@ -77645,14 +83123,20 @@ func UnmarshalReservationPatch(m map[string]json.RawMessage, result interface{}) // AsPatch returns a generic map representation of the ReservationPatch func (reservationPatch *ReservationPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(reservationPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(reservationPatch.Capacity) { + _patch["capacity"] = reservationPatch.Capacity.asPatch() } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(reservationPatch.CommittedUse) { + _patch["committed_use"] = reservationPatch.CommittedUse.asPatch() + } + if !core.IsNil(reservationPatch.Name) { + _patch["name"] = reservationPatch.Name } + if !core.IsNil(reservationPatch.Profile) { + _patch["profile"] = reservationPatch.Profile.asPatch() + } + return } @@ -77728,6 +83212,19 @@ func UnmarshalReservationProfilePatch(m map[string]json.RawMessage, result inter return } +// asPatch returns a generic map representation of the ReservationProfilePatch +func (reservationProfilePatch *ReservationProfilePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(reservationProfilePatch.Name) { + _patch["name"] = reservationProfilePatch.Name + } + if !core.IsNil(reservationProfilePatch.ResourceType) { + _patch["resource_type"] = reservationProfilePatch.ResourceType + } + + return +} + // ReservationProfilePrototype : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this reservation. type ReservationProfilePrototype struct { // The globally unique name of the profile. @@ -77926,6 +83423,9 @@ type ReservedIP struct { // The target this reserved IP is bound to. // // If absent, this reserved IP is provider-owned or unbound. + // + // The resources supported by this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Target ReservedIPTargetIntf `json:"target,omitempty"` } @@ -78017,14 +83517,14 @@ func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err // ReservedIPCollection : ReservedIPCollection struct type ReservedIPCollection struct { // A link to the first page of resources. - First *ReservedIPCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ReservedIPCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of reserved IPs in the subnet. ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` @@ -78036,7 +83536,7 @@ type ReservedIPCollection struct { // UnmarshalReservedIPCollection unmarshals an instance of ReservedIPCollection from the specified map of raw messages. func UnmarshalReservedIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservedIPCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -78046,7 +83546,7 @@ func UnmarshalReservedIPCollection(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -78083,7 +83583,7 @@ func (resp *ReservedIPCollection) GetNextStart() (*string, error) { // ReservedIPCollectionBareMetalServerNetworkInterfaceContext : ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { // A link to the first page of resources. - First *ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of reserved IPs bound to the bare metal server network interface. Ips []ReservedIP `json:"ips" validate:"required"` @@ -78093,7 +83593,7 @@ type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -78102,7 +83602,7 @@ type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { // UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContext from the specified map of raw messages. func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -78117,7 +83617,7 @@ func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext(m map[s err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -78131,46 +83631,10 @@ func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext(m map[s return } -// ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst : A link to the first page of resources. -type ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct type ReservedIPCollectionEndpointGatewayContext struct { // A link to the first page of resources. - First *ReservedIPCollectionEndpointGatewayContextFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of reserved IPs bound to the endpoint gateway. Ips []ReservedIP `json:"ips" validate:"required"` @@ -78180,7 +83644,7 @@ type ReservedIPCollectionEndpointGatewayContext struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -78189,7 +83653,7 @@ type ReservedIPCollectionEndpointGatewayContext struct { // UnmarshalReservedIPCollectionEndpointGatewayContext unmarshals an instance of ReservedIPCollectionEndpointGatewayContext from the specified map of raw messages. func UnmarshalReservedIPCollectionEndpointGatewayContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservedIPCollectionEndpointGatewayContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionEndpointGatewayContextFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -78204,7 +83668,7 @@ func UnmarshalReservedIPCollectionEndpointGatewayContext(m map[string]json.RawMe err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionEndpointGatewayContextNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -78233,64 +83697,10 @@ func (resp *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, return start, nil } -// ReservedIPCollectionEndpointGatewayContextFirst : A link to the first page of resources. -type ReservedIPCollectionEndpointGatewayContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionEndpointGatewayContextFirst unmarshals an instance of ReservedIPCollectionEndpointGatewayContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionEndpointGatewayContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionEndpointGatewayContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionEndpointGatewayContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionEndpointGatewayContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionEndpointGatewayContextNext unmarshals an instance of ReservedIPCollectionEndpointGatewayContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionEndpointGatewayContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionEndpointGatewayContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionFirst : A link to the first page of resources. -type ReservedIPCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionFirst unmarshals an instance of ReservedIPCollectionFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ReservedIPCollectionInstanceNetworkInterfaceContext : ReservedIPCollectionInstanceNetworkInterfaceContext struct type ReservedIPCollectionInstanceNetworkInterfaceContext struct { // A link to the first page of resources. - First *ReservedIPCollectionInstanceNetworkInterfaceContextFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of reserved IPs bound to the instance network interface. Ips []ReservedIP `json:"ips" validate:"required"` @@ -78300,7 +83710,7 @@ type ReservedIPCollectionInstanceNetworkInterfaceContext struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ReservedIPCollectionInstanceNetworkInterfaceContextNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -78309,7 +83719,7 @@ type ReservedIPCollectionInstanceNetworkInterfaceContext struct { // UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContext from the specified map of raw messages. func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservedIPCollectionInstanceNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -78324,7 +83734,7 @@ func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext(m map[string]j err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -78353,64 +83763,10 @@ func (resp *ReservedIPCollectionInstanceNetworkInterfaceContext) GetNextStart() return start, nil } -// ReservedIPCollectionInstanceNetworkInterfaceContextFirst : A link to the first page of resources. -type ReservedIPCollectionInstanceNetworkInterfaceContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionInstanceNetworkInterfaceContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionInstanceNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionInstanceNetworkInterfaceContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionInstanceNetworkInterfaceContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionNext unmarshals an instance of ReservedIPCollectionNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ReservedIPCollectionVirtualNetworkInterfaceContext : ReservedIPCollectionVirtualNetworkInterfaceContext struct type ReservedIPCollectionVirtualNetworkInterfaceContext struct { // A link to the first page of resources. - First *ReservedIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of reserved IPs bound to the virtual network interface specified by the identifier in the URL. Ips []ReservedIPReference `json:"ips" validate:"required"` @@ -78420,7 +83776,7 @@ type ReservedIPCollectionVirtualNetworkInterfaceContext struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ReservedIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -78429,7 +83785,7 @@ type ReservedIPCollectionVirtualNetworkInterfaceContext struct { // UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages. func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservedIPCollectionVirtualNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -78444,7 +83800,7 @@ func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext(m map[string]js err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -78473,42 +83829,6 @@ func (resp *ReservedIPCollectionVirtualNetworkInterfaceContext) GetNextStart() ( return start, nil } -// ReservedIPCollectionVirtualNetworkInterfaceContextFirst : A link to the first page of resources. -type ReservedIPCollectionVirtualNetworkInterfaceContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionVirtualNetworkInterfaceContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollectionVirtualNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionVirtualNetworkInterfaceContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionVirtualNetworkInterfaceContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ReservedIPPatch : ReservedIPPatch struct type ReservedIPPatch struct { // Indicates whether this reserved IP member will be automatically deleted when either @@ -78539,14 +83859,14 @@ func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) // AsPatch returns a generic map representation of the ReservedIPPatch func (reservedIPPatch *ReservedIPPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(reservedIPPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(reservedIPPatch.AutoDelete) { + _patch["auto_delete"] = reservedIPPatch.AutoDelete } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(reservedIPPatch.Name) { + _patch["name"] = reservedIPPatch.Name } + return } @@ -78623,6 +83943,9 @@ func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface // ReservedIPTarget : The target this reserved IP is bound to. // // If absent, this reserved IP is provider-owned or unbound. +// +// The resources supported by this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. // Models which "extend" this model: // - ReservedIPTargetEndpointGatewayReference // - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext @@ -78773,6 +84096,16 @@ func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) ( return } +// asPatch returns a generic map representation of the ResourceFilter +func (resourceFilter *ResourceFilter) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(resourceFilter.ResourceType) { + _patch["resource_type"] = resourceFilter.ResourceType + } + + return +} + // ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. // Models which "extend" this model: @@ -78841,7 +84174,7 @@ type RestartBareMetalServerOptions struct { // The bare metal server identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -78872,7 +84205,7 @@ type RevokeAccountForPrivatePathServiceGatewayOptions struct { // The account that will be revoked access to the private path service gateway. Account AccountIdentityIntf `json:"account" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -79082,390 +84415,138 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error return } -// RouteCollection : RouteCollection struct -type RouteCollection struct { - // A link to the first page of resources. - First *RouteCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *RouteCollectionNext `json:"next,omitempty"` - - // A page of routes in the routing table. - Routes []Route `json:"routes" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalRouteCollection unmarshals an instance of RouteCollection from the specified map of raw messages. -func UnmarshalRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRouteCollectionFirst) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) - if err != nil { - err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *RouteCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil - } - return start, nil -} - -// RouteCollectionFirst : A link to the first page of resources. -type RouteCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRouteCollectionFirst unmarshals an instance of RouteCollectionFirst from the specified map of raw messages. -func UnmarshalRouteCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type RouteCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRouteCollectionNext unmarshals an instance of RouteCollectionNext from the specified map of raw messages. -func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollectionVPCContext : RouteCollectionVPCContext struct -type RouteCollectionVPCContext struct { - // A link to the first page of resources. - First *RouteCollectionVPCContextFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *RouteCollectionVPCContextNext `json:"next,omitempty"` - - // A page of routes in the routing table. - Routes []RouteCollectionVPCContextRoutesItem `json:"routes" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalRouteCollectionVPCContext unmarshals an instance of RouteCollectionVPCContext from the specified map of raw messages. -func UnmarshalRouteCollectionVPCContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionVPCContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRouteCollectionVPCContextFirst) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) - if err != nil { - err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *RouteCollectionVPCContext) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil - } - return start, nil -} - -// RouteCollectionVPCContextFirst : A link to the first page of resources. -type RouteCollectionVPCContextFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRouteCollectionVPCContextFirst unmarshals an instance of RouteCollectionVPCContextFirst from the specified map of raw messages. -func UnmarshalRouteCollectionVPCContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionVPCContextFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollectionVPCContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type RouteCollectionVPCContextNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRouteCollectionVPCContextNext unmarshals an instance of RouteCollectionVPCContextNext from the specified map of raw messages. -func UnmarshalRouteCollectionVPCContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionVPCContextNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteCollectionVPCContextRoutesItem : RouteCollectionVPCContextRoutesItem struct -type RouteCollectionVPCContextRoutesItem struct { - // The action to perform with a packet matching the route: - // - `delegate`: delegate to system-provided routes - // - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes - // - `deliver`: deliver the packet to the specified `next_hop` - // - `drop`: drop the packet - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Action *string `json:"action" validate:"required"` - - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - Advertise *bool `json:"advertise" validate:"required"` - - // The date and time that the route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If present, the resource that created the route. Routes with this property present cannot - // be directly deleted. All routes with an `origin` of `service` will have this property set, - // and future `origin` values may also have this property set. - Creator RouteCreatorIntf `json:"creator,omitempty"` - - // The destination CIDR of the route. - Destination *string `json:"destination" validate:"required"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, its `address` will be `0.0.0.0`. - NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` - - // The origin of this route: - // - `service`: route was directly created by a service - // - `user`: route was directly created by a user - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Origin *string `json:"origin" validate:"required"` - - // The priority of this route. Smaller values have higher priority. - // - // If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest - // priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is - // distributed between them. - Priority *int64 `json:"priority" validate:"required"` - - // The zone the route applies to. - // - // If subnets are attached to the route's routing table, egress traffic from those - // subnets in this zone will be subject to this route. If this route's routing table - // has any of `route_direct_link_ingress`, `route_internet_ingress`, - // `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic - // from those ingress sources arriving in this zone will be subject to this route. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the RouteCollectionVPCContextRoutesItem.Action property. -// The action to perform with a packet matching the route: -// - `delegate`: delegate to system-provided routes -// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes -// - `deliver`: deliver the packet to the specified `next_hop` -// - `drop`: drop the packet -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - RouteCollectionVPCContextRoutesItemActionDelegateConst = "delegate" - RouteCollectionVPCContextRoutesItemActionDelegateVPCConst = "delegate_vpc" - RouteCollectionVPCContextRoutesItemActionDeliverConst = "deliver" - RouteCollectionVPCContextRoutesItemActionDropConst = "drop" -) - -// Constants associated with the RouteCollectionVPCContextRoutesItem.LifecycleState property. -// The lifecycle state of the route. -const ( - RouteCollectionVPCContextRoutesItemLifecycleStateDeletingConst = "deleting" - RouteCollectionVPCContextRoutesItemLifecycleStateFailedConst = "failed" - RouteCollectionVPCContextRoutesItemLifecycleStatePendingConst = "pending" - RouteCollectionVPCContextRoutesItemLifecycleStateStableConst = "stable" - RouteCollectionVPCContextRoutesItemLifecycleStateSuspendedConst = "suspended" - RouteCollectionVPCContextRoutesItemLifecycleStateUpdatingConst = "updating" - RouteCollectionVPCContextRoutesItemLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the RouteCollectionVPCContextRoutesItem.Origin property. -// The origin of this route: -// - `service`: route was directly created by a service -// - `user`: route was directly created by a user -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - RouteCollectionVPCContextRoutesItemOriginServiceConst = "service" - RouteCollectionVPCContextRoutesItemOriginUserConst = "user" -) - -// UnmarshalRouteCollectionVPCContextRoutesItem unmarshals an instance of RouteCollectionVPCContextRoutesItem from the specified map of raw messages. -func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCollectionVPCContextRoutesItem) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) - if err != nil { - err = core.SDKErrorf(err, "", "advertise-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) - if err != nil { - err = core.SDKErrorf(err, "", "creator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) - if err != nil { - err = core.SDKErrorf(err, "", "next_hop-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) - if err != nil { - err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - +// RouteCollection : RouteCollection struct +type RouteCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // A page of routes in the routing table. + Routes []Route `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalRouteCollection unmarshals an instance of RouteCollection from the specified map of raw messages. +func UnmarshalRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + if err != nil { + err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *RouteCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + +// RouteCollectionVPCContext : RouteCollectionVPCContext struct +type RouteCollectionVPCContext struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` + + // A page of routes in the routing table. + Routes []Route `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalRouteCollectionVPCContext unmarshals an instance of RouteCollectionVPCContext from the specified map of raw messages. +func UnmarshalRouteCollectionVPCContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionVPCContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + if err != nil { + err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *RouteCollectionVPCContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + // RouteCreator : If present, the resource that created the route. Routes with this property present cannot be directly deleted. All // routes with an `origin` of `service` will have this property set, and future `origin` values may also have this // property set. @@ -79652,6 +84733,7 @@ func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { type RouteNextHopPatchIntf interface { isaRouteNextHopPatch() bool + asPatch() map[string]interface{} } // UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages. @@ -79676,6 +84758,22 @@ func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{} return } +// asPatch returns a generic map representation of the RouteNextHopPatch +func (routeNextHopPatch *RouteNextHopPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routeNextHopPatch.Address) { + _patch["address"] = routeNextHopPatch.Address + } + if !core.IsNil(routeNextHopPatch.ID) { + _patch["id"] = routeNextHopPatch.ID + } + if !core.IsNil(routeNextHopPatch.Href) { + _patch["href"] = routeNextHopPatch.Href + } + + return +} + // RouteNextHopPrototype : If `action` is `deliver`, the next hop that packets will be delivered to (must not be // `0.0.0.0`). For other `action` values, it must be omitted or specified as `0.0.0.0`. // @@ -79788,14 +84886,20 @@ func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err // AsPatch returns a generic map representation of the RoutePatch func (routePatch *RoutePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(routePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(routePatch.Advertise) { + _patch["advertise"] = routePatch.Advertise } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(routePatch.Name) { + _patch["name"] = routePatch.Name + } + if !core.IsNil(routePatch.NextHop) { + _patch["next_hop"] = routePatch.NextHop.asPatch() } + if !core.IsNil(routePatch.Priority) { + _patch["priority"] = routePatch.Priority + } + return } @@ -79965,8 +85069,8 @@ func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) ( type RoutingTable struct { // The filters specifying the resources that may create routes in this routing table. // - // At present, only the `resource_type` filter is permitted, and only the values - // `vpn_gateway` and `vpn_server` are supported, but filter support is expected to expand in the future. + // The resources and types of filters supported by this property is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these @@ -80171,14 +85275,14 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er // RoutingTableCollection : RoutingTableCollection struct type RoutingTableCollection struct { // A link to the first page of resources. - First *RoutingTableCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *RoutingTableCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of routing tables. RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` @@ -80190,7 +85294,7 @@ type RoutingTableCollection struct { // UnmarshalRoutingTableCollection unmarshals an instance of RoutingTableCollection from the specified map of raw messages. func UnmarshalRoutingTableCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutingTableCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRoutingTableCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -80200,7 +85304,7 @@ func UnmarshalRoutingTableCollection(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRoutingTableCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -80234,42 +85338,6 @@ func (resp *RoutingTableCollection) GetNextStart() (*string, error) { return start, nil } -// RoutingTableCollectionFirst : A link to the first page of resources. -type RoutingTableCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRoutingTableCollectionFirst unmarshals an instance of RoutingTableCollectionFirst from the specified map of raw messages. -func UnmarshalRoutingTableCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type RoutingTableCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalRoutingTableCollectionNext unmarshals an instance of RoutingTableCollectionNext from the specified map of raw messages. -func UnmarshalRoutingTableCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // RoutingTableIdentity : Identifies a routing table by a unique property. // Models which "extend" this model: // - RoutingTableIdentityByCRN @@ -80292,6 +85360,7 @@ func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { type RoutingTableIdentityIntf interface { isaRoutingTableIdentity() bool + asPatch() map[string]interface{} } // UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. @@ -80316,12 +85385,30 @@ func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interfac return } +// asPatch returns a generic map representation of the RoutingTableIdentity +func (routingTableIdentity *RoutingTableIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routingTableIdentity.CRN) { + _patch["crn"] = routingTableIdentity.CRN + } + if !core.IsNil(routingTableIdentity.ID) { + _patch["id"] = routingTableIdentity.ID + } + if !core.IsNil(routingTableIdentity.Href) { + _patch["href"] = routingTableIdentity.Href + } + + return +} + // RoutingTablePatch : RoutingTablePatch struct type RoutingTablePatch struct { // The filters specifying the resources that may create routes in this routing table // (replacing any existing filters). All routes created by resources that match a given filter will be removed when an // existing filter is removed. Therefore, if an empty array is specified, all filters will be removed, resulting in all // routes not directly created by the user being removed. + // + // If specified, `resource_type` must be `vpn_gateway` or `vpn_server`. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` // The ingress sources to advertise routes to, replacing any existing sources to advertise to. Routes in the table with @@ -80439,14 +85526,33 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} // AsPatch returns a generic map representation of the RoutingTablePatch func (routingTablePatch *RoutingTablePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(routingTablePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(routingTablePatch.AcceptRoutesFrom) { + var acceptRoutesFromPatches []map[string]interface{} + for _, acceptRoutesFrom := range routingTablePatch.AcceptRoutesFrom { + acceptRoutesFromPatches = append(acceptRoutesFromPatches, acceptRoutesFrom.asPatch()) + } + _patch["accept_routes_from"] = acceptRoutesFromPatches } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(routingTablePatch.AdvertiseRoutesTo) { + _patch["advertise_routes_to"] = routingTablePatch.AdvertiseRoutesTo + } + if !core.IsNil(routingTablePatch.Name) { + _patch["name"] = routingTablePatch.Name + } + if !core.IsNil(routingTablePatch.RouteDirectLinkIngress) { + _patch["route_direct_link_ingress"] = routingTablePatch.RouteDirectLinkIngress } + if !core.IsNil(routingTablePatch.RouteInternetIngress) { + _patch["route_internet_ingress"] = routingTablePatch.RouteInternetIngress + } + if !core.IsNil(routingTablePatch.RouteTransitGatewayIngress) { + _patch["route_transit_gateway_ingress"] = routingTablePatch.RouteTransitGatewayIngress + } + if !core.IsNil(routingTablePatch.RouteVPCZoneIngress) { + _patch["route_vpc_zone_ingress"] = routingTablePatch.RouteVPCZoneIngress + } + return } @@ -80600,14 +85706,14 @@ func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (e // SecurityGroupCollection : SecurityGroupCollection struct type SecurityGroupCollection struct { // A link to the first page of resources. - First *SecurityGroupCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *SecurityGroupCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of security groups. SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` @@ -80619,7 +85725,7 @@ type SecurityGroupCollection struct { // UnmarshalSecurityGroupCollection unmarshals an instance of SecurityGroupCollection from the specified map of raw messages. func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SecurityGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -80629,7 +85735,7 @@ func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -80663,42 +85769,6 @@ func (resp *SecurityGroupCollection) GetNextStart() (*string, error) { return start, nil } -// SecurityGroupCollectionFirst : A link to the first page of resources. -type SecurityGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSecurityGroupCollectionFirst unmarshals an instance of SecurityGroupCollectionFirst from the specified map of raw messages. -func UnmarshalSecurityGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SecurityGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSecurityGroupCollectionNext unmarshals an instance of SecurityGroupCollectionNext from the specified map of raw messages. -func UnmarshalSecurityGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SecurityGroupIdentity : Identifies a security group by a unique property. // Models which "extend" this model: // - SecurityGroupIdentityByID @@ -80765,14 +85835,11 @@ func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{ // AsPatch returns a generic map representation of the SecurityGroupPatch func (securityGroupPatch *SecurityGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(securityGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupPatch.Name) { + _patch["name"] = securityGroupPatch.Name } + return } @@ -81047,6 +86114,7 @@ func (*SecurityGroupRuleLocalPatch) isaSecurityGroupRuleLocalPatch() bool { type SecurityGroupRuleLocalPatchIntf interface { isaSecurityGroupRuleLocalPatch() bool + asPatch() map[string]interface{} } // UnmarshalSecurityGroupRuleLocalPatch unmarshals an instance of SecurityGroupRuleLocalPatch from the specified map of raw messages. @@ -81066,6 +86134,19 @@ func UnmarshalSecurityGroupRuleLocalPatch(m map[string]json.RawMessage, result i return } +// asPatch returns a generic map representation of the SecurityGroupRuleLocalPatch +func (securityGroupRuleLocalPatch *SecurityGroupRuleLocalPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleLocalPatch.Address) { + _patch["address"] = securityGroupRuleLocalPatch.Address + } + if !core.IsNil(securityGroupRuleLocalPatch.CIDRBlock) { + _patch["cidr_block"] = securityGroupRuleLocalPatch.CIDRBlock + } + + return +} + // SecurityGroupRuleLocalPrototype : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for // outbound traffic) // @@ -81228,14 +86309,32 @@ func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interf // AsPatch returns a generic map representation of the SecurityGroupRulePatch func (securityGroupRulePatch *SecurityGroupRulePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(securityGroupRulePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRulePatch.Code) { + _patch["code"] = securityGroupRulePatch.Code } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(securityGroupRulePatch.Direction) { + _patch["direction"] = securityGroupRulePatch.Direction + } + if !core.IsNil(securityGroupRulePatch.IPVersion) { + _patch["ip_version"] = securityGroupRulePatch.IPVersion + } + if !core.IsNil(securityGroupRulePatch.Local) { + _patch["local"] = securityGroupRulePatch.Local.asPatch() + } + if !core.IsNil(securityGroupRulePatch.PortMax) { + _patch["port_max"] = securityGroupRulePatch.PortMax + } + if !core.IsNil(securityGroupRulePatch.PortMin) { + _patch["port_min"] = securityGroupRulePatch.PortMin + } + if !core.IsNil(securityGroupRulePatch.Remote) { + _patch["remote"] = securityGroupRulePatch.Remote.asPatch() } + if !core.IsNil(securityGroupRulePatch.Type) { + _patch["type"] = securityGroupRulePatch.Type + } + return } @@ -81332,42 +86431,53 @@ type SecurityGroupRulePrototypeIntf interface { // UnmarshalSecurityGroupRulePrototype unmarshals an instance of SecurityGroupRulePrototype from the specified map of raw messages. func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "protocol", &discValue) + obj := new(SecurityGroupRulePrototype) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll-error", common.GetComponentInfo()) - } - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp-error", common.GetComponentInfo()) - } - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + err = core.SDKErrorf(err, "", "port_max-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + err = core.SDKErrorf(err, "", "port_min-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -81494,6 +86604,7 @@ func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { type SecurityGroupRuleRemotePatchIntf interface { isaSecurityGroupRuleRemotePatch() bool + asPatch() map[string]interface{} } // UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. @@ -81528,6 +86639,28 @@ func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the SecurityGroupRuleRemotePatch +func (securityGroupRuleRemotePatch *SecurityGroupRuleRemotePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleRemotePatch.Address) { + _patch["address"] = securityGroupRuleRemotePatch.Address + } + if !core.IsNil(securityGroupRuleRemotePatch.CIDRBlock) { + _patch["cidr_block"] = securityGroupRuleRemotePatch.CIDRBlock + } + if !core.IsNil(securityGroupRuleRemotePatch.ID) { + _patch["id"] = securityGroupRuleRemotePatch.ID + } + if !core.IsNil(securityGroupRuleRemotePatch.CRN) { + _patch["crn"] = securityGroupRuleRemotePatch.CRN + } + if !core.IsNil(securityGroupRuleRemotePatch.Href) { + _patch["href"] = securityGroupRuleRemotePatch.Href + } + + return +} + // SecurityGroupRuleRemotePrototype : The remote IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). // Can be specified as an IP address, a CIDR block, or a security group within the VPC. // @@ -81603,14 +86736,14 @@ func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, res // SecurityGroupTargetCollection : SecurityGroupTargetCollection struct type SecurityGroupTargetCollection struct { // A link to the first page of resources. - First *SecurityGroupTargetCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *SecurityGroupTargetCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of targets for the security group. Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` @@ -81622,7 +86755,7 @@ type SecurityGroupTargetCollection struct { // UnmarshalSecurityGroupTargetCollection unmarshals an instance of SecurityGroupTargetCollection from the specified map of raw messages. func UnmarshalSecurityGroupTargetCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SecurityGroupTargetCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupTargetCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -81632,7 +86765,7 @@ func UnmarshalSecurityGroupTargetCollection(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupTargetCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -81666,42 +86799,6 @@ func (resp *SecurityGroupTargetCollection) GetNextStart() (*string, error) { return start, nil } -// SecurityGroupTargetCollectionFirst : A link to the first page of resources. -type SecurityGroupTargetCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSecurityGroupTargetCollectionFirst unmarshals an instance of SecurityGroupTargetCollectionFirst from the specified map of raw messages. -func UnmarshalSecurityGroupTargetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SecurityGroupTargetCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSecurityGroupTargetCollectionNext unmarshals an instance of SecurityGroupTargetCollectionNext from the specified map of raw messages. -func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SecurityGroupTargetReference : A target of this security group. // // The resources supported by this property may @@ -81818,7 +86915,7 @@ type SetSubnetPublicGatewayOptions struct { // The public gateway identity. PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -82422,14 +87519,14 @@ type ShareAccessorBindingCollection struct { AccessorBindings []ShareAccessorBinding `json:"accessor_bindings" validate:"required"` // A link to the first page of resources. - First *ShareAccessorBindingCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ShareAccessorBindingCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -82443,7 +87540,7 @@ func UnmarshalShareAccessorBindingCollection(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "accessor_bindings-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareAccessorBindingCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -82453,7 +87550,7 @@ func UnmarshalShareAccessorBindingCollection(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareAccessorBindingCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -82482,42 +87579,6 @@ func (resp *ShareAccessorBindingCollection) GetNextStart() (*string, error) { return start, nil } -// ShareAccessorBindingCollectionFirst : A link to the first page of resources. -type ShareAccessorBindingCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareAccessorBindingCollectionFirst unmarshals an instance of ShareAccessorBindingCollectionFirst from the specified map of raw messages. -func UnmarshalShareAccessorBindingCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareAccessorBindingCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareAccessorBindingCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ShareAccessorBindingCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareAccessorBindingCollectionNext unmarshals an instance of ShareAccessorBindingCollectionNext from the specified map of raw messages. -func UnmarshalShareAccessorBindingCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareAccessorBindingCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ShareAccessorBindingReference : ShareAccessorBindingReference struct type ShareAccessorBindingReference struct { // The URL for this share accessor binding. @@ -82561,14 +87622,14 @@ func UnmarshalShareAccessorBindingReference(m map[string]json.RawMessage, result // ShareCollection : ShareCollection struct type ShareCollection struct { // A link to the first page of resources. - First *ShareCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ShareCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of file shares. Shares []Share `json:"shares" validate:"required"` @@ -82580,7 +87641,7 @@ type ShareCollection struct { // UnmarshalShareCollection unmarshals an instance of ShareCollection from the specified map of raw messages. func UnmarshalShareCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -82590,7 +87651,7 @@ func UnmarshalShareCollection(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -82624,42 +87685,6 @@ func (resp *ShareCollection) GetNextStart() (*string, error) { return start, nil } -// ShareCollectionFirst : A link to the first page of resources. -type ShareCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareCollectionFirst unmarshals an instance of ShareCollectionFirst from the specified map of raw messages. -func UnmarshalShareCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ShareCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareCollectionNext unmarshals an instance of ShareCollectionNext from the specified map of raw messages. -func UnmarshalShareCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ShareIdentity : Identifies a file share by a unique property. // Models which "extend" this model: // - ShareIdentityByID @@ -83148,7 +88173,7 @@ func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) // ShareMountTargetCollection : ShareMountTargetCollection struct type ShareMountTargetCollection struct { // A link to the first page of resources. - First *ShareMountTargetCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` @@ -83158,7 +88183,7 @@ type ShareMountTargetCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ShareMountTargetCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -83167,7 +88192,7 @@ type ShareMountTargetCollection struct { // UnmarshalShareMountTargetCollection unmarshals an instance of ShareMountTargetCollection from the specified map of raw messages. func UnmarshalShareMountTargetCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareMountTargetCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareMountTargetCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -83182,7 +88207,7 @@ func UnmarshalShareMountTargetCollection(m map[string]json.RawMessage, result in err = core.SDKErrorf(err, "", "mount_targets-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareMountTargetCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -83211,42 +88236,6 @@ func (resp *ShareMountTargetCollection) GetNextStart() (*string, error) { return start, nil } -// ShareMountTargetCollectionFirst : A link to the first page of resources. -type ShareMountTargetCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareMountTargetCollectionFirst unmarshals an instance of ShareMountTargetCollectionFirst from the specified map of raw messages. -func UnmarshalShareMountTargetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ShareMountTargetCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareMountTargetCollectionNext unmarshals an instance of ShareMountTargetCollectionNext from the specified map of raw messages. -func UnmarshalShareMountTargetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ShareMountTargetPatch : ShareMountTargetPatch struct type ShareMountTargetPatch struct { // The name for this share mount target. The name must not be used by another mount target for the file share. @@ -83267,14 +88256,11 @@ func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interfa // AsPatch returns a generic map representation of the ShareMountTargetPatch func (shareMountTargetPatch *ShareMountTargetPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(shareMountTargetPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(shareMountTargetPatch.Name) { + _patch["name"] = shareMountTargetPatch.Name } + return } @@ -83506,9 +88492,8 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // packets that are invalid based on the current connection state and protocol. See [Protocol state filtering // mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. const ( - ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeAutoConst = "auto" - ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeDisabledConst = "disabled" - ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeEnabledConst = "enabled" + ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeAutoConst = "auto" + ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeEnabledConst = "enabled" ) func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { @@ -83625,7 +88610,7 @@ type SharePatch struct { // The cron specification for the file share replication schedule. // - // Replication of a share can be scheduled to occur at most once per hour. + // Replication of a share can be scheduled to occur at most once every 15 minutes. // // For this property to be changed, the share `replication_role` must be `replica`. ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` @@ -83718,14 +88703,32 @@ func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err // AsPatch returns a generic map representation of the SharePatch func (sharePatch *SharePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(sharePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(sharePatch.AccessControlMode) { + _patch["access_control_mode"] = sharePatch.AccessControlMode } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(sharePatch.AllowedTransitEncryptionModes) { + _patch["allowed_transit_encryption_modes"] = sharePatch.AllowedTransitEncryptionModes + } + if !core.IsNil(sharePatch.Iops) { + _patch["iops"] = sharePatch.Iops + } + if !core.IsNil(sharePatch.Name) { + _patch["name"] = sharePatch.Name + } + if !core.IsNil(sharePatch.Profile) { + _patch["profile"] = sharePatch.Profile.asPatch() } + if !core.IsNil(sharePatch.ReplicationCronSpec) { + _patch["replication_cron_spec"] = sharePatch.ReplicationCronSpec + } + if !core.IsNil(sharePatch.Size) { + _patch["size"] = sharePatch.Size + } + if !core.IsNil(sharePatch.UserTags) { + _patch["user_tags"] = sharePatch.UserTags + } + return } @@ -83808,8 +88811,8 @@ func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (er // ShareProfileCapacity : ShareProfileCapacity struct // Models which "extend" this model: // - ShareProfileCapacityFixed -// - ShareProfileCapacityRange // - ShareProfileCapacityEnum +// - ShareProfileCapacityRange // - ShareProfileCapacityDependentRange type ShareProfileCapacity struct { // The type for this profile field. @@ -83818,6 +88821,9 @@ type ShareProfileCapacity struct { // The value for this profile field. Value *int64 `json:"value,omitempty"` + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` + // The default value for this profile field. Default *int64 `json:"default,omitempty"` @@ -83829,9 +88835,6 @@ type ShareProfileCapacity struct { // The increment step value for this profile field. Step *int64 `json:"step,omitempty"` - - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` } // Constants associated with the ShareProfileCapacity.Type property. @@ -83861,6 +88864,11 @@ func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) @@ -83881,11 +88889,6 @@ func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -83893,14 +88896,14 @@ func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interfac // ShareProfileCollection : ShareProfileCollection struct type ShareProfileCollection struct { // A link to the first page of resources. - First *ShareProfileCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *ShareProfileCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of share profiles. Profiles []ShareProfile `json:"profiles" validate:"required"` @@ -83912,7 +88915,7 @@ type ShareProfileCollection struct { // UnmarshalShareProfileCollection unmarshals an instance of ShareProfileCollection from the specified map of raw messages. func UnmarshalShareProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareProfileCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -83922,7 +88925,7 @@ func UnmarshalShareProfileCollection(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareProfileCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -83956,42 +88959,6 @@ func (resp *ShareProfileCollection) GetNextStart() (*string, error) { return start, nil } -// ShareProfileCollectionFirst : A link to the first page of resources. -type ShareProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareProfileCollectionFirst unmarshals an instance of ShareProfileCollectionFirst from the specified map of raw messages. -func UnmarshalShareProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type ShareProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalShareProfileCollectionNext unmarshals an instance of ShareProfileCollectionNext from the specified map of raw messages. -func UnmarshalShareProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ShareProfileIops : ShareProfileIops struct // Models which "extend" this model: // - ShareProfileIopsFixed @@ -84095,6 +89062,7 @@ func (*ShareProfileIdentity) isaShareProfileIdentity() bool { type ShareProfileIdentityIntf interface { isaShareProfileIdentity() bool + asPatch() map[string]interface{} } // UnmarshalShareProfileIdentity unmarshals an instance of ShareProfileIdentity from the specified map of raw messages. @@ -84114,6 +89082,19 @@ func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interfac return } +// asPatch returns a generic map representation of the ShareProfileIdentity +func (shareProfileIdentity *ShareProfileIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(shareProfileIdentity.Name) { + _patch["name"] = shareProfileIdentity.Name + } + if !core.IsNil(shareProfileIdentity.Href) { + _patch["href"] = shareProfileIdentity.Href + } + + return +} + // ShareProfileReference : ShareProfileReference struct type ShareProfileReference struct { // The URL for this share profile. @@ -84226,7 +89207,7 @@ type SharePrototype struct { // The cron specification for the file share replication schedule. // - // Replication of a share can be scheduled to occur at most once per hour. + // Replication of a share can be scheduled to occur at most once every 15 minutes. // // The scheduling frequency for this property may // [increase](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -84397,7 +89378,7 @@ type SharePrototypeShareContext struct { // The cron specification for the file share replication schedule. // - // Replication of a share can be scheduled to occur at most once per hour. + // Replication of a share can be scheduled to occur at most once every 15 minutes. ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` // The resource group to use. If unspecified, the resource group from @@ -84707,6 +89688,10 @@ type Snapshot struct { // The operating system included in this snapshot. OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + // Indicates the progress (as a percentage) of storing this snapshot. Only stored snapshots can be used for + // restoration. + Progress *int64 `json:"progress" validate:"required"` + // The resource group for this snapshot. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -84851,6 +89836,11 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "progress", &obj.Progress) + if err != nil { + err = core.SDKErrorf(err, "", "progress-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) @@ -85016,14 +90006,14 @@ func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interf // SnapshotCollection : SnapshotCollection struct type SnapshotCollection struct { // A link to the first page of resources. - First *SnapshotCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *SnapshotCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of snapshots. Snapshots []Snapshot `json:"snapshots" validate:"required"` @@ -85035,7 +90025,7 @@ type SnapshotCollection struct { // UnmarshalSnapshotCollection unmarshals an instance of SnapshotCollection from the specified map of raw messages. func UnmarshalSnapshotCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SnapshotCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSnapshotCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -85045,7 +90035,7 @@ func UnmarshalSnapshotCollection(m map[string]json.RawMessage, result interface{ err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSnapshotCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -85079,42 +90069,6 @@ func (resp *SnapshotCollection) GetNextStart() (*string, error) { return start, nil } -// SnapshotCollectionFirst : A link to the first page of resources. -type SnapshotCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSnapshotCollectionFirst unmarshals an instance of SnapshotCollectionFirst from the specified map of raw messages. -func UnmarshalSnapshotCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SnapshotCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSnapshotCollectionNext unmarshals an instance of SnapshotCollectionNext from the specified map of raw messages. -func UnmarshalSnapshotCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SnapshotConsistencyGroup : SnapshotConsistencyGroup struct type SnapshotConsistencyGroup struct { // If present, the backup policy plan which created this snapshot consistency group. @@ -85246,14 +90200,14 @@ func UnmarshalSnapshotConsistencyGroup(m map[string]json.RawMessage, result inte // SnapshotConsistencyGroupCollection : SnapshotConsistencyGroupCollection struct type SnapshotConsistencyGroupCollection struct { // A link to the first page of resources. - First *SnapshotConsistencyGroupCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *SnapshotConsistencyGroupCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of snapshot consistency groups. SnapshotConsistencyGroups []SnapshotConsistencyGroup `json:"snapshot_consistency_groups" validate:"required"` @@ -85265,7 +90219,7 @@ type SnapshotConsistencyGroupCollection struct { // UnmarshalSnapshotConsistencyGroupCollection unmarshals an instance of SnapshotConsistencyGroupCollection from the specified map of raw messages. func UnmarshalSnapshotConsistencyGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SnapshotConsistencyGroupCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSnapshotConsistencyGroupCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -85275,7 +90229,7 @@ func UnmarshalSnapshotConsistencyGroupCollection(m map[string]json.RawMessage, r err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSnapshotConsistencyGroupCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -85309,42 +90263,6 @@ func (resp *SnapshotConsistencyGroupCollection) GetNextStart() (*string, error) return start, nil } -// SnapshotConsistencyGroupCollectionFirst : A link to the first page of resources. -type SnapshotConsistencyGroupCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSnapshotConsistencyGroupCollectionFirst unmarshals an instance of SnapshotConsistencyGroupCollectionFirst from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotConsistencyGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SnapshotConsistencyGroupCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSnapshotConsistencyGroupCollectionNext unmarshals an instance of SnapshotConsistencyGroupCollectionNext from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SnapshotConsistencyGroupPatch : SnapshotConsistencyGroupPatch struct type SnapshotConsistencyGroupPatch struct { // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. @@ -85374,14 +90292,14 @@ func UnmarshalSnapshotConsistencyGroupPatch(m map[string]json.RawMessage, result // AsPatch returns a generic map representation of the SnapshotConsistencyGroupPatch func (snapshotConsistencyGroupPatch *SnapshotConsistencyGroupPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(snapshotConsistencyGroupPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(snapshotConsistencyGroupPatch.DeleteSnapshotsOnDelete) { + _patch["delete_snapshots_on_delete"] = snapshotConsistencyGroupPatch.DeleteSnapshotsOnDelete } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(snapshotConsistencyGroupPatch.Name) { + _patch["name"] = snapshotConsistencyGroupPatch.Name } + return } @@ -85656,14 +90574,14 @@ func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (e // AsPatch returns a generic map representation of the SnapshotPatch func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(snapshotPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(snapshotPatch.Name) { + _patch["name"] = snapshotPatch.Name } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(snapshotPatch.UserTags) { + _patch["user_tags"] = snapshotPatch.UserTags } + return } @@ -85984,7 +90902,7 @@ type StartBareMetalServerOptions struct { // The bare metal server identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -86017,7 +90935,7 @@ type StopBareMetalServerOptions struct { // - `hard`: immediately stop the server. Type *string `json:"type" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -86236,14 +91154,14 @@ func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err erro // SubnetCollection : SubnetCollection struct type SubnetCollection struct { // A link to the first page of resources. - First *SubnetCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *SubnetCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of subnets. Subnets []Subnet `json:"subnets" validate:"required"` @@ -86255,7 +91173,7 @@ type SubnetCollection struct { // UnmarshalSubnetCollection unmarshals an instance of SubnetCollection from the specified map of raw messages. func UnmarshalSubnetCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SubnetCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSubnetCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -86265,7 +91183,7 @@ func UnmarshalSubnetCollection(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSubnetCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -86299,42 +91217,6 @@ func (resp *SubnetCollection) GetNextStart() (*string, error) { return start, nil } -// SubnetCollectionFirst : A link to the first page of resources. -type SubnetCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSubnetCollectionFirst unmarshals an instance of SubnetCollectionFirst from the specified map of raw messages. -func UnmarshalSubnetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SubnetCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalSubnetCollectionNext unmarshals an instance of SubnetCollectionNext from the specified map of raw messages. -func UnmarshalSubnetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SubnetIdentity : Identifies a subnet by a unique property. // Models which "extend" this model: // - SubnetIdentityByID @@ -86357,6 +91239,7 @@ func (*SubnetIdentity) isaSubnetIdentity() bool { type SubnetIdentityIntf interface { isaSubnetIdentity() bool + asPatch() map[string]interface{} } // UnmarshalSubnetIdentity unmarshals an instance of SubnetIdentity from the specified map of raw messages. @@ -86381,6 +91264,22 @@ func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) ( return } +// asPatch returns a generic map representation of the SubnetIdentity +func (subnetIdentity *SubnetIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetIdentity.ID) { + _patch["id"] = subnetIdentity.ID + } + if !core.IsNil(subnetIdentity.CRN) { + _patch["crn"] = subnetIdentity.CRN + } + if !core.IsNil(subnetIdentity.Href) { + _patch["href"] = subnetIdentity.Href + } + + return +} + // SubnetPatch : SubnetPatch struct type SubnetPatch struct { // The name for this subnet. The name must not be used by another subnet in the VPC. @@ -86427,14 +91326,20 @@ func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err // AsPatch returns a generic map representation of the SubnetPatch func (subnetPatch *SubnetPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(subnetPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(subnetPatch.Name) { + _patch["name"] = subnetPatch.Name } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(subnetPatch.NetworkACL) { + _patch["network_acl"] = subnetPatch.NetworkACL.asPatch() + } + if !core.IsNil(subnetPatch.PublicGateway) { + _patch["public_gateway"] = subnetPatch.PublicGateway.asPatch() + } + if !core.IsNil(subnetPatch.RoutingTable) { + _patch["routing_table"] = subnetPatch.RoutingTable.asPatch() } + return } @@ -86578,6 +91483,7 @@ func (*SubnetPublicGatewayPatch) isaSubnetPublicGatewayPatch() bool { type SubnetPublicGatewayPatchIntf interface { isaSubnetPublicGatewayPatch() bool + asPatch() map[string]interface{} } // UnmarshalSubnetPublicGatewayPatch unmarshals an instance of SubnetPublicGatewayPatch from the specified map of raw messages. @@ -86602,6 +91508,22 @@ func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the SubnetPublicGatewayPatch +func (subnetPublicGatewayPatch *SubnetPublicGatewayPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetPublicGatewayPatch.ID) { + _patch["id"] = subnetPublicGatewayPatch.ID + } + if !core.IsNil(subnetPublicGatewayPatch.CRN) { + _patch["crn"] = subnetPublicGatewayPatch.CRN + } + if !core.IsNil(subnetPublicGatewayPatch.Href) { + _patch["href"] = subnetPublicGatewayPatch.Href + } + + return +} + // SubnetReference : SubnetReference struct type SubnetReference struct { // The CRN for this subnet. @@ -86669,8 +91591,8 @@ func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) // TrustedProfileIdentity : Identifies a trusted profile by a unique property. // Models which "extend" this model: -// - TrustedProfileIdentityTrustedProfileByID -// - TrustedProfileIdentityTrustedProfileByCRN +// - TrustedProfileIdentityByID +// - TrustedProfileIdentityByCRN type TrustedProfileIdentity struct { // The unique identifier for this trusted profile. ID *string `json:"id,omitempty"` @@ -86749,7 +91671,7 @@ type UnpublishPrivatePathServiceGatewayOptions struct { // The private path service gateway identifier. PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -86777,7 +91699,7 @@ type UnsetSubnetPublicGatewayOptions struct { // The subnet identifier. ID *string `json:"id" validate:"required,ne="` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -86812,7 +91734,7 @@ type UpdateBackupPolicyOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -86863,7 +91785,7 @@ type UpdateBackupPolicyPlanOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -86917,7 +91839,7 @@ type UpdateBareMetalServerDiskOptions struct { // The bare metal server disk patch. BareMetalServerDiskPatch map[string]interface{} `json:"BareMetalServerDisk_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -86965,7 +91887,7 @@ type UpdateBareMetalServerNetworkAttachmentOptions struct { // The bare metal server network attachment patch. BareMetalServerNetworkAttachmentPatch map[string]interface{} `json:"BareMetalServerNetworkAttachment_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87013,7 +91935,7 @@ type UpdateBareMetalServerNetworkInterfaceOptions struct { // The bare metal server network interface patch. BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87058,7 +91980,7 @@ type UpdateBareMetalServerOptions struct { // The bare metal server patch. BareMetalServerPatch map[string]interface{} `json:"BareMetalServer_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87088,6 +92010,238 @@ func (options *UpdateBareMetalServerOptions) SetHeaders(param map[string]string) return options } +// UpdateClusterNetworkInterfaceOptions : The UpdateClusterNetworkInterface options. +type UpdateClusterNetworkInterfaceOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The cluster network interface patch. + ClusterNetworkInterfacePatch map[string]interface{} `json:"ClusterNetworkInterface_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewUpdateClusterNetworkInterfaceOptions : Instantiate UpdateClusterNetworkInterfaceOptions +func (*VpcV1) NewUpdateClusterNetworkInterfaceOptions(clusterNetworkID string, id string, clusterNetworkInterfacePatch map[string]interface{}) *UpdateClusterNetworkInterfaceOptions { + return &UpdateClusterNetworkInterfaceOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ID: core.StringPtr(id), + ClusterNetworkInterfacePatch: clusterNetworkInterfacePatch, + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *UpdateClusterNetworkInterfaceOptions) SetClusterNetworkID(clusterNetworkID string) *UpdateClusterNetworkInterfaceOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateClusterNetworkInterfaceOptions) SetID(id string) *UpdateClusterNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetClusterNetworkInterfacePatch : Allow user to set ClusterNetworkInterfacePatch +func (_options *UpdateClusterNetworkInterfaceOptions) SetClusterNetworkInterfacePatch(clusterNetworkInterfacePatch map[string]interface{}) *UpdateClusterNetworkInterfaceOptions { + _options.ClusterNetworkInterfacePatch = clusterNetworkInterfacePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateClusterNetworkInterfaceOptions) SetIfMatch(ifMatch string) *UpdateClusterNetworkInterfaceOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateClusterNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateClusterNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateClusterNetworkOptions : The UpdateClusterNetwork options. +type UpdateClusterNetworkOptions struct { + // The cluster network identifier. + ID *string `json:"id" validate:"required,ne="` + + // The cluster network patch. + ClusterNetworkPatch map[string]interface{} `json:"ClusterNetwork_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewUpdateClusterNetworkOptions : Instantiate UpdateClusterNetworkOptions +func (*VpcV1) NewUpdateClusterNetworkOptions(id string, clusterNetworkPatch map[string]interface{}) *UpdateClusterNetworkOptions { + return &UpdateClusterNetworkOptions{ + ID: core.StringPtr(id), + ClusterNetworkPatch: clusterNetworkPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateClusterNetworkOptions) SetID(id string) *UpdateClusterNetworkOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetClusterNetworkPatch : Allow user to set ClusterNetworkPatch +func (_options *UpdateClusterNetworkOptions) SetClusterNetworkPatch(clusterNetworkPatch map[string]interface{}) *UpdateClusterNetworkOptions { + _options.ClusterNetworkPatch = clusterNetworkPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateClusterNetworkOptions) SetIfMatch(ifMatch string) *UpdateClusterNetworkOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateClusterNetworkOptions) SetHeaders(param map[string]string) *UpdateClusterNetworkOptions { + options.Headers = param + return options +} + +// UpdateClusterNetworkSubnetOptions : The UpdateClusterNetworkSubnet options. +type UpdateClusterNetworkSubnetOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The cluster network subnet patch. + ClusterNetworkSubnetPatch map[string]interface{} `json:"ClusterNetworkSubnet_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewUpdateClusterNetworkSubnetOptions : Instantiate UpdateClusterNetworkSubnetOptions +func (*VpcV1) NewUpdateClusterNetworkSubnetOptions(clusterNetworkID string, id string, clusterNetworkSubnetPatch map[string]interface{}) *UpdateClusterNetworkSubnetOptions { + return &UpdateClusterNetworkSubnetOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ID: core.StringPtr(id), + ClusterNetworkSubnetPatch: clusterNetworkSubnetPatch, + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *UpdateClusterNetworkSubnetOptions) SetClusterNetworkID(clusterNetworkID string) *UpdateClusterNetworkSubnetOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateClusterNetworkSubnetOptions) SetID(id string) *UpdateClusterNetworkSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetClusterNetworkSubnetPatch : Allow user to set ClusterNetworkSubnetPatch +func (_options *UpdateClusterNetworkSubnetOptions) SetClusterNetworkSubnetPatch(clusterNetworkSubnetPatch map[string]interface{}) *UpdateClusterNetworkSubnetOptions { + _options.ClusterNetworkSubnetPatch = clusterNetworkSubnetPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateClusterNetworkSubnetOptions) SetIfMatch(ifMatch string) *UpdateClusterNetworkSubnetOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateClusterNetworkSubnetOptions) SetHeaders(param map[string]string) *UpdateClusterNetworkSubnetOptions { + options.Headers = param + return options +} + +// UpdateClusterNetworkSubnetReservedIPOptions : The UpdateClusterNetworkSubnetReservedIP options. +type UpdateClusterNetworkSubnetReservedIPOptions struct { + // The cluster network identifier. + ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="` + + // The cluster network subnet identifier. + ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="` + + // The cluster network subnet reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // The cluster network subnet reserved IP patch. + ClusterNetworkSubnetReservedIPPatch map[string]interface{} `json:"ClusterNetworkSubnetReservedIP_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewUpdateClusterNetworkSubnetReservedIPOptions : Instantiate UpdateClusterNetworkSubnetReservedIPOptions +func (*VpcV1) NewUpdateClusterNetworkSubnetReservedIPOptions(clusterNetworkID string, clusterNetworkSubnetID string, id string, clusterNetworkSubnetReservedIPPatch map[string]interface{}) *UpdateClusterNetworkSubnetReservedIPOptions { + return &UpdateClusterNetworkSubnetReservedIPOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID), + ID: core.StringPtr(id), + ClusterNetworkSubnetReservedIPPatch: clusterNetworkSubnetReservedIPPatch, + } +} + +// SetClusterNetworkID : Allow user to set ClusterNetworkID +func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkID(clusterNetworkID string) *UpdateClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkID = core.StringPtr(clusterNetworkID) + return _options +} + +// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID +func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *UpdateClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetID(id string) *UpdateClusterNetworkSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetClusterNetworkSubnetReservedIPPatch : Allow user to set ClusterNetworkSubnetReservedIPPatch +func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetReservedIPPatch(clusterNetworkSubnetReservedIPPatch map[string]interface{}) *UpdateClusterNetworkSubnetReservedIPOptions { + _options.ClusterNetworkSubnetReservedIPPatch = clusterNetworkSubnetReservedIPPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetIfMatch(ifMatch string) *UpdateClusterNetworkSubnetReservedIPOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateClusterNetworkSubnetReservedIPOptions) SetHeaders(param map[string]string) *UpdateClusterNetworkSubnetReservedIPOptions { + options.Headers = param + return options +} + // UpdateDedicatedHostDiskOptions : The UpdateDedicatedHostDisk options. type UpdateDedicatedHostDiskOptions struct { // The dedicated host identifier. @@ -87099,7 +92253,7 @@ type UpdateDedicatedHostDiskOptions struct { // The dedicated host disk patch. DedicatedHostDiskPatch map[string]interface{} `json:"DedicatedHostDisk_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87144,7 +92298,7 @@ type UpdateDedicatedHostGroupOptions struct { // The dedicated host group patch. DedicatedHostGroupPatch map[string]interface{} `json:"DedicatedHostGroup_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87182,7 +92336,7 @@ type UpdateDedicatedHostOptions struct { // The dedicated host patch. DedicatedHostPatch map[string]interface{} `json:"DedicatedHost_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87220,7 +92374,7 @@ type UpdateEndpointGatewayOptions struct { // The endpoint gateway patch. EndpointGatewayPatch map[string]interface{} `json:"EndpointGateway_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87258,7 +92412,7 @@ type UpdateFirmwareForBareMetalServerOptions struct { // Indicates whether to automatically start the bare metal server after the firmware update is successfully completed. AutoStart *bool `json:"auto_start,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87295,7 +92449,7 @@ type UpdateFloatingIPOptions struct { // The floating IP patch. FloatingIPPatch map[string]interface{} `json:"FloatingIP_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87333,7 +92487,7 @@ type UpdateFlowLogCollectorOptions struct { // The flow log collector patch. FlowLogCollectorPatch map[string]interface{} `json:"FlowLogCollector_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87371,7 +92525,7 @@ type UpdateIkePolicyOptions struct { // The IKE policy patch. IkePolicyPatch map[string]interface{} `json:"IkePolicy_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87412,7 +92566,7 @@ type UpdateImageExportJobOptions struct { // The image export job patch. ImageExportJobPatch map[string]interface{} `json:"ImageExportJob_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87457,7 +92611,7 @@ type UpdateImageOptions struct { // The image patch. ImagePatch map[string]interface{} `json:"Image_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87487,6 +92641,54 @@ func (options *UpdateImageOptions) SetHeaders(param map[string]string) *UpdateIm return options } +// UpdateInstanceClusterNetworkAttachmentOptions : The UpdateInstanceClusterNetworkAttachment options. +type UpdateInstanceClusterNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance cluster network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance cluster network attachment patch. + InstanceClusterNetworkAttachmentPatch map[string]interface{} `json:"InstanceClusterNetworkAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewUpdateInstanceClusterNetworkAttachmentOptions : Instantiate UpdateInstanceClusterNetworkAttachmentOptions +func (*VpcV1) NewUpdateInstanceClusterNetworkAttachmentOptions(instanceID string, id string, instanceClusterNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceClusterNetworkAttachmentOptions { + return &UpdateInstanceClusterNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceClusterNetworkAttachmentPatch: instanceClusterNetworkAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceClusterNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceClusterNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceClusterNetworkAttachmentOptions) SetID(id string) *UpdateInstanceClusterNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceClusterNetworkAttachmentPatch : Allow user to set InstanceClusterNetworkAttachmentPatch +func (_options *UpdateInstanceClusterNetworkAttachmentOptions) SetInstanceClusterNetworkAttachmentPatch(instanceClusterNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceClusterNetworkAttachmentOptions { + _options.InstanceClusterNetworkAttachmentPatch = instanceClusterNetworkAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceClusterNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceClusterNetworkAttachmentOptions { + options.Headers = param + return options +} + // UpdateInstanceDiskOptions : The UpdateInstanceDisk options. type UpdateInstanceDiskOptions struct { // The virtual server instance identifier. @@ -87498,7 +92700,7 @@ type UpdateInstanceDiskOptions struct { // The instance disk patch. InstanceDiskPatch map[string]interface{} `json:"InstanceDisk_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87549,7 +92751,7 @@ type UpdateInstanceGroupManagerActionOptions struct { // The instance group manager action patch. InstanceGroupManagerActionPatch map[string]interface{} `json:"InstanceGroupManagerAction_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87604,7 +92806,7 @@ type UpdateInstanceGroupManagerOptions struct { // The instance group manager patch. InstanceGroupManagerPatch map[string]interface{} `json:"InstanceGroupManager_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87655,7 +92857,7 @@ type UpdateInstanceGroupManagerPolicyOptions struct { // The instance group manager policy patch. InstanceGroupManagerPolicyPatch map[string]interface{} `json:"InstanceGroupManagerPolicy_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87710,7 +92912,7 @@ type UpdateInstanceGroupMembershipOptions struct { // The instance group membership patch. InstanceGroupMembershipPatch map[string]interface{} `json:"InstanceGroupMembership_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87755,7 +92957,7 @@ type UpdateInstanceGroupOptions struct { // The instance group patch. InstanceGroupPatch map[string]interface{} `json:"InstanceGroup_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87796,7 +92998,7 @@ type UpdateInstanceNetworkAttachmentOptions struct { // The instance network attachment patch. InstanceNetworkAttachmentPatch map[string]interface{} `json:"InstanceNetworkAttachment_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87844,7 +93046,7 @@ type UpdateInstanceNetworkInterfaceOptions struct { // The instance network interface patch. NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87893,7 +93095,7 @@ type UpdateInstanceOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87937,7 +93139,7 @@ type UpdateInstanceTemplateOptions struct { // The instance template patch. InstanceTemplatePatch map[string]interface{} `json:"InstanceTemplate_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -87978,7 +93180,7 @@ type UpdateInstanceVolumeAttachmentOptions struct { // The volume attachment patch. VolumeAttachmentPatch map[string]interface{} `json:"VolumeAttachment_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88023,7 +93225,7 @@ type UpdateIpsecPolicyOptions struct { // The IPsec policy patch. IPsecPolicyPatch map[string]interface{} `json:"IPsecPolicy_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88061,7 +93263,7 @@ type UpdateKeyOptions struct { // The key patch. KeyPatch map[string]interface{} `json:"Key_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88102,7 +93304,7 @@ type UpdateLoadBalancerListenerOptions struct { // The load balancer listener patch. LoadBalancerListenerPatch map[string]interface{} `json:"LoadBalancerListener_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88153,7 +93355,7 @@ type UpdateLoadBalancerListenerPolicyOptions struct { // The listener policy patch. LoadBalancerListenerPolicyPatch map[string]interface{} `json:"LoadBalancerListenerPolicy_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88214,7 +93416,7 @@ type UpdateLoadBalancerListenerPolicyRuleOptions struct { // The listener policy rule patch. LoadBalancerListenerPolicyRulePatch map[string]interface{} `json:"LoadBalancerListenerPolicyRule_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88277,7 +93479,7 @@ type UpdateLoadBalancerOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88327,7 +93529,7 @@ type UpdateLoadBalancerPoolMemberOptions struct { // The load balancer pool member patch. LoadBalancerPoolMemberPatch map[string]interface{} `json:"LoadBalancerPoolMember_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88382,7 +93584,7 @@ type UpdateLoadBalancerPoolOptions struct { // The load balancer pool patch. LoadBalancerPoolPatch map[string]interface{} `json:"LoadBalancerPool_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88427,7 +93629,7 @@ type UpdateNetworkACLOptions struct { // The network ACL patch. NetworkACLPatch map[string]interface{} `json:"NetworkACL_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88468,7 +93670,7 @@ type UpdateNetworkACLRuleOptions struct { // The network ACL rule patch. NetworkACLRulePatch map[string]interface{} `json:"NetworkACLRule_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88513,7 +93715,7 @@ type UpdatePlacementGroupOptions struct { // The placement group patch. PlacementGroupPatch map[string]interface{} `json:"PlacementGroup_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88554,7 +93756,7 @@ type UpdatePrivatePathServiceGatewayAccountPolicyOptions struct { // The account policy patch. PrivatePathServiceGatewayAccountPolicyPatch map[string]interface{} `json:"PrivatePathServiceGatewayAccountPolicy_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88599,7 +93801,7 @@ type UpdatePrivatePathServiceGatewayOptions struct { // The private path service gateway patch. PrivatePathServiceGatewayPatch map[string]interface{} `json:"PrivatePathServiceGateway_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88637,7 +93839,7 @@ type UpdatePublicGatewayOptions struct { // The public gateway patch. PublicGatewayPatch map[string]interface{} `json:"PublicGateway_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88675,7 +93877,7 @@ type UpdateReservationOptions struct { // The reservation patch. ReservationPatch map[string]interface{} `json:"Reservation_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88713,7 +93915,7 @@ type UpdateSecurityGroupOptions struct { // The security group patch. SecurityGroupPatch map[string]interface{} `json:"SecurityGroup_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88754,7 +93956,7 @@ type UpdateSecurityGroupRuleOptions struct { // The security group rule patch. SecurityGroupRulePatch map[string]interface{} `json:"SecurityGroupRule_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88802,7 +94004,7 @@ type UpdateShareMountTargetOptions struct { // The share mount target patch. ShareMountTargetPatch map[string]interface{} `json:"ShareMountTarget_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88851,7 +94053,7 @@ type UpdateShareOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88899,7 +94101,7 @@ type UpdateSnapshotConsistencyGroupOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88947,7 +94149,7 @@ type UpdateSnapshotOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -88991,7 +94193,7 @@ type UpdateSubnetOptions struct { // The subnet patch. SubnetPatch map[string]interface{} `json:"Subnet_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89032,7 +94234,7 @@ type UpdateSubnetReservedIPOptions struct { // The reserved IP patch. ReservedIPPatch map[string]interface{} `json:"ReservedIP_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89077,7 +94279,7 @@ type UpdateVirtualNetworkInterfaceOptions struct { // The virtual network interface patch. VirtualNetworkInterfacePatch map[string]interface{} `json:"VirtualNetworkInterface_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89119,7 +94321,7 @@ type UpdateVolumeOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89166,7 +94368,7 @@ type UpdateVPCAddressPrefixOptions struct { // The prefix patch. AddressPrefixPatch map[string]interface{} `json:"AddressPrefix_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89214,7 +94416,7 @@ type UpdateVPCDnsResolutionBindingOptions struct { // The DNS resolution binding patch. VpcdnsResolutionBindingPatch map[string]interface{} `json:"VpcdnsResolutionBinding_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89263,7 +94465,7 @@ type UpdateVPCOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89310,7 +94512,7 @@ type UpdateVPCRouteOptions struct { // The route patch. RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89362,7 +94564,7 @@ type UpdateVPCRoutingTableOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89419,7 +94621,7 @@ type UpdateVPCRoutingTableRouteOptions struct { // The VPC route patch. RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89474,7 +94676,7 @@ type UpdateVPNGatewayConnectionOptions struct { // The VPN gateway connection patch. VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89519,7 +94721,7 @@ type UpdateVPNGatewayOptions struct { // The VPN gateway patch. VPNGatewayPatch map[string]interface{} `json:"VPNGateway_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89561,7 +94763,7 @@ type UpdateVPNServerOptions struct { // Required if the request body includes an array. IfMatch *string `json:"If-Match,omitempty"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89608,7 +94810,7 @@ type UpdateVPNServerRouteOptions struct { // The VPN route patch. VPNServerRoutePatch map[string]interface{} `json:"VPNServerRoute_patch" validate:"required"` - // Allows users to set headers on API requests + // Allows users to set headers on API requests. Headers map[string]string } @@ -89893,14 +95095,14 @@ func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) ( // VPCCollection : VPCCollection struct type VPCCollection struct { // A link to the first page of resources. - First *VPCCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VPCCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -89912,7 +95114,7 @@ type VPCCollection struct { // UnmarshalVPCCollection unmarshals an instance of VPCCollection from the specified map of raw messages. func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPCCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPCCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -89922,7 +95124,7 @@ func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPCCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -89956,42 +95158,6 @@ func (resp *VPCCollection) GetNextStart() (*string, error) { return start, nil } -// VPCCollectionFirst : A link to the first page of resources. -type VPCCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPCCollectionFirst unmarshals an instance of VPCCollectionFirst from the specified map of raw messages. -func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPCCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPCCollectionNext unmarshals an instance of VPCCollectionNext from the specified map of raw messages. -func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // Vpcdns : The DNS configuration for this VPC. type Vpcdns struct { // Indicates whether this VPC is enabled as a DNS name resolution hub. @@ -90056,6 +95222,19 @@ func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err return } +// asPatch returns a generic map representation of the VpcdnsPatch +func (vpcdnsPatch *VpcdnsPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcdnsPatch.EnableHub) { + _patch["enable_hub"] = vpcdnsPatch.EnableHub + } + if !core.IsNil(vpcdnsPatch.Resolver) { + _patch["resolver"] = vpcdnsPatch.Resolver.asPatch() + } + + return +} + // VpcdnsPrototype : The DNS configuration for this VPC. // // If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint gateways within this VPC, @@ -90224,14 +95403,14 @@ type VpcdnsResolutionBindingCollection struct { DnsResolutionBindings []VpcdnsResolutionBinding `json:"dns_resolution_bindings" validate:"required"` // A link to the first page of resources. - First *VpcdnsResolutionBindingCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VpcdnsResolutionBindingCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -90245,7 +95424,7 @@ func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, re err = core.SDKErrorf(err, "", "dns_resolution_bindings-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVpcdnsResolutionBindingCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -90255,7 +95434,7 @@ func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, re err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVpcdnsResolutionBindingCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -90345,14 +95524,11 @@ func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result // AsPatch returns a generic map representation of the VpcdnsResolutionBindingPatch func (vpcdnsResolutionBindingPatch *VpcdnsResolutionBindingPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpcdnsResolutionBindingPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(vpcdnsResolutionBindingPatch.Name) { + _patch["name"] = vpcdnsResolutionBindingPatch.Name } + return } @@ -90592,6 +95768,26 @@ func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface return } +// asPatch returns a generic map representation of the VpcdnsResolverPatch +func (vpcdnsResolverPatch *VpcdnsResolverPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcdnsResolverPatch.ManualServers) { + var manualServersPatches []map[string]interface{} + for _, manualServers := range vpcdnsResolverPatch.ManualServers { + manualServersPatches = append(manualServersPatches, manualServers.asPatch()) + } + _patch["manual_servers"] = manualServersPatches + } + if !core.IsNil(vpcdnsResolverPatch.Type) { + _patch["type"] = vpcdnsResolverPatch.Type + } + if !core.IsNil(vpcdnsResolverPatch.VPC) { + _patch["vpc"] = vpcdnsResolverPatch.VPC.asPatch() + } + + return +} + // VpcdnsResolverPrototype : VpcdnsResolverPrototype struct // Models which "extend" this model: // - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype @@ -90683,6 +95879,7 @@ func (*VpcdnsResolverVPCPatch) isaVpcdnsResolverVPCPatch() bool { type VpcdnsResolverVPCPatchIntf interface { isaVpcdnsResolverVPCPatch() bool + asPatch() map[string]interface{} } // UnmarshalVpcdnsResolverVPCPatch unmarshals an instance of VpcdnsResolverVPCPatch from the specified map of raw messages. @@ -90707,6 +95904,22 @@ func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interf return } +// asPatch returns a generic map representation of the VpcdnsResolverVPCPatch +func (vpcdnsResolverVPCPatch *VpcdnsResolverVPCPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcdnsResolverVPCPatch.ID) { + _patch["id"] = vpcdnsResolverVPCPatch.ID + } + if !core.IsNil(vpcdnsResolverVPCPatch.CRN) { + _patch["crn"] = vpcdnsResolverVPCPatch.CRN + } + if !core.IsNil(vpcdnsResolverVPCPatch.Href) { + _patch["href"] = vpcdnsResolverVPCPatch.Href + } + + return +} + // VPCHealthReason : VPCHealthReason struct type VPCHealthReason struct { // A reason code for this health state. @@ -90822,14 +96035,14 @@ func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err er // AsPatch returns a generic map representation of the VPCPatch func (vpcPatch *VPCPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpcPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(vpcPatch.Dns) { + _patch["dns"] = vpcPatch.Dns.asPatch() } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(vpcPatch.Name) { + _patch["name"] = vpcPatch.Name } + return } @@ -91264,14 +96477,14 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err // VPNGatewayCollection : VPNGatewayCollection struct type VPNGatewayCollection struct { // A link to the first page of resources. - First *VPNGatewayCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VPNGatewayCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -91283,7 +96496,7 @@ type VPNGatewayCollection struct { // UnmarshalVPNGatewayCollection unmarshals an instance of VPNGatewayCollection from the specified map of raw messages. func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -91293,7 +96506,7 @@ func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -91327,42 +96540,6 @@ func (resp *VPNGatewayCollection) GetNextStart() (*string, error) { return start, nil } -// VPNGatewayCollectionFirst : A link to the first page of resources. -type VPNGatewayCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNGatewayCollectionFirst unmarshals an instance of VPNGatewayCollectionFirst from the specified map of raw messages. -func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNGatewayCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNGatewayCollectionNext unmarshals an instance of VPNGatewayCollectionNext from the specified map of raw messages. -func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnection : VPNGatewayConnection struct // Models which "extend" this model: // - VPNGatewayConnectionRouteMode @@ -91557,14 +96734,14 @@ type VPNGatewayConnectionCollection struct { Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` // A link to the first page of resources. - First *VPNGatewayConnectionCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VPNGatewayConnectionCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -91578,7 +96755,7 @@ func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayConnectionCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -91588,7 +96765,7 @@ func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayConnectionCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -91617,42 +96794,6 @@ func (resp *VPNGatewayConnectionCollection) GetNextStart() (*string, error) { return start, nil } -// VPNGatewayConnectionCollectionFirst : A link to the first page of resources. -type VPNGatewayConnectionCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionCollectionFirst unmarshals an instance of VPNGatewayConnectionCollectionFirst from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNGatewayConnectionCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionCollectionNext unmarshals an instance of VPNGatewayConnectionCollectionNext from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionDpd : The Dead Peer Detection settings. type VPNGatewayConnectionDpd struct { // Dead Peer Detection actions. @@ -91739,6 +96880,22 @@ func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the VPNGatewayConnectionDpdPatch +func (vpnGatewayConnectionDpdPatch *VPNGatewayConnectionDpdPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionDpdPatch.Action) { + _patch["action"] = vpnGatewayConnectionDpdPatch.Action + } + if !core.IsNil(vpnGatewayConnectionDpdPatch.Interval) { + _patch["interval"] = vpnGatewayConnectionDpdPatch.Interval + } + if !core.IsNil(vpnGatewayConnectionDpdPatch.Timeout) { + _patch["timeout"] = vpnGatewayConnectionDpdPatch.Timeout + } + + return +} + // VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. type VPNGatewayConnectionDpdPrototype struct { // Dead Peer Detection actions. @@ -91903,6 +97060,7 @@ func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch type VPNGatewayConnectionIkePolicyPatchIntf interface { isaVPNGatewayConnectionIkePolicyPatch() bool + asPatch() map[string]interface{} } // UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages. @@ -91922,6 +97080,19 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, r return } +// asPatch returns a generic map representation of the VPNGatewayConnectionIkePolicyPatch +func (vpnGatewayConnectionIkePolicyPatch *VPNGatewayConnectionIkePolicyPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionIkePolicyPatch.ID) { + _patch["id"] = vpnGatewayConnectionIkePolicyPatch.ID + } + if !core.IsNil(vpnGatewayConnectionIkePolicyPatch.Href) { + _patch["href"] = vpnGatewayConnectionIkePolicyPatch.Href + } + + return +} + // VPNGatewayConnectionIkePolicyPrototype : The IKE policy to use. If unspecified, [auto-negotiation will be // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). // Models which "extend" this model: @@ -91979,6 +97150,7 @@ func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyP type VPNGatewayConnectionIPsecPolicyPatchIntf interface { isaVPNGatewayConnectionIPsecPolicyPatch() bool + asPatch() map[string]interface{} } // UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages. @@ -91998,6 +97170,19 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, return } +// asPatch returns a generic map representation of the VPNGatewayConnectionIPsecPolicyPatch +func (vpnGatewayConnectionIPsecPolicyPatch *VPNGatewayConnectionIPsecPolicyPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionIPsecPolicyPatch.ID) { + _patch["id"] = vpnGatewayConnectionIPsecPolicyPatch.ID + } + if !core.IsNil(vpnGatewayConnectionIPsecPolicyPatch.Href) { + _patch["href"] = vpnGatewayConnectionIPsecPolicyPatch.Href + } + + return +} + // VPNGatewayConnectionIPsecPolicyPrototype : The IPsec policy to use. If unspecified, [auto-negotiation will be // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). // Models which "extend" this model: @@ -92146,14 +97331,35 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int // AsPatch returns a generic map representation of the VPNGatewayConnectionPatch func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnGatewayConnectionPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPatch.AdminStateUp) { + _patch["admin_state_up"] = vpnGatewayConnectionPatch.AdminStateUp } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(vpnGatewayConnectionPatch.DeadPeerDetection) { + _patch["dead_peer_detection"] = vpnGatewayConnectionPatch.DeadPeerDetection.asPatch() + } + if !core.IsNil(vpnGatewayConnectionPatch.DistributeTraffic) { + _patch["distribute_traffic"] = vpnGatewayConnectionPatch.DistributeTraffic + } + if !core.IsNil(vpnGatewayConnectionPatch.EstablishMode) { + _patch["establish_mode"] = vpnGatewayConnectionPatch.EstablishMode + } + if !core.IsNil(vpnGatewayConnectionPatch.IkePolicy) { + _patch["ike_policy"] = vpnGatewayConnectionPatch.IkePolicy.asPatch() } + if !core.IsNil(vpnGatewayConnectionPatch.IpsecPolicy) { + _patch["ipsec_policy"] = vpnGatewayConnectionPatch.IpsecPolicy.asPatch() + } + if !core.IsNil(vpnGatewayConnectionPatch.Name) { + _patch["name"] = vpnGatewayConnectionPatch.Name + } + if !core.IsNil(vpnGatewayConnectionPatch.Peer) { + _patch["peer"] = vpnGatewayConnectionPatch.Peer.asPatch() + } + if !core.IsNil(vpnGatewayConnectionPatch.Psk) { + _patch["psk"] = vpnGatewayConnectionPatch.Psk + } + return } @@ -92175,6 +97381,7 @@ func (*VPNGatewayConnectionPeerPatch) isaVPNGatewayConnectionPeerPatch() bool { type VPNGatewayConnectionPeerPatchIntf interface { isaVPNGatewayConnectionPeerPatch() bool + asPatch() map[string]interface{} } // UnmarshalVPNGatewayConnectionPeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatch from the specified map of raw messages. @@ -92194,6 +97401,19 @@ func UnmarshalVPNGatewayConnectionPeerPatch(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the VPNGatewayConnectionPeerPatch +func (vpnGatewayConnectionPeerPatch *VPNGatewayConnectionPeerPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPeerPatch.Address) { + _patch["address"] = vpnGatewayConnectionPeerPatch.Address + } + if !core.IsNil(vpnGatewayConnectionPeerPatch.Fqdn) { + _patch["fqdn"] = vpnGatewayConnectionPeerPatch.Fqdn + } + + return +} + // VPNGatewayConnectionPolicyModeLocal : VPNGatewayConnectionPolicyModeLocal struct type VPNGatewayConnectionPolicyModeLocal struct { // The local CIDRs for this VPN gateway connection. @@ -93273,14 +98493,11 @@ func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) // AsPatch returns a generic map representation of the VPNGatewayPatch func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnGatewayPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayPatch.Name) { + _patch["name"] = vpnGatewayPatch.Name } + return } @@ -93714,6 +98931,7 @@ func (*VPNServerAuthenticationByUsernameIDProvider) isaVPNServerAuthenticationBy type VPNServerAuthenticationByUsernameIDProviderIntf interface { isaVPNServerAuthenticationByUsernameIDProvider() bool + asPatch() map[string]interface{} } // UnmarshalVPNServerAuthenticationByUsernameIDProvider unmarshals an instance of VPNServerAuthenticationByUsernameIDProvider from the specified map of raw messages. @@ -93728,6 +98946,16 @@ func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawM return } +// asPatch returns a generic map representation of the VPNServerAuthenticationByUsernameIDProvider +func (vpnServerAuthenticationByUsernameIDProvider *VPNServerAuthenticationByUsernameIDProvider) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnServerAuthenticationByUsernameIDProvider.ProviderType) { + _patch["provider_type"] = vpnServerAuthenticationByUsernameIDProvider.ProviderType + } + + return +} + // VPNServerAuthenticationPrototype : An authentication method for this VPN server. // Models which "extend" this model: // - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype @@ -93759,6 +98987,7 @@ func (*VPNServerAuthenticationPrototype) isaVPNServerAuthenticationPrototype() b type VPNServerAuthenticationPrototypeIntf interface { isaVPNServerAuthenticationPrototype() bool + asPatch() map[string]interface{} } // UnmarshalVPNServerAuthenticationPrototype unmarshals an instance of VPNServerAuthenticationPrototype from the specified map of raw messages. @@ -93792,6 +99021,25 @@ func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, res return } +// asPatch returns a generic map representation of the VPNServerAuthenticationPrototype +func (vpnServerAuthenticationPrototype *VPNServerAuthenticationPrototype) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnServerAuthenticationPrototype.Method) { + _patch["method"] = vpnServerAuthenticationPrototype.Method + } + if !core.IsNil(vpnServerAuthenticationPrototype.IdentityProvider) { + _patch["identity_provider"] = vpnServerAuthenticationPrototype.IdentityProvider.asPatch() + } + if !core.IsNil(vpnServerAuthenticationPrototype.ClientCa) { + _patch["client_ca"] = vpnServerAuthenticationPrototype.ClientCa.asPatch() + } + if !core.IsNil(vpnServerAuthenticationPrototype.Crl) { + _patch["crl"] = vpnServerAuthenticationPrototype.Crl + } + + return +} + // VPNServerClient : VPNServerClient struct type VPNServerClient struct { // The IP address assigned to this VPN client from `client_ip_pool`. @@ -93925,14 +99173,14 @@ type VPNServerClientCollection struct { Clients []VPNServerClient `json:"clients" validate:"required"` // A link to the first page of resources. - First *VPNServerClientCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VPNServerClientCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -93946,7 +99194,7 @@ func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "clients-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -93956,7 +99204,7 @@ func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerClientCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -93985,53 +99233,17 @@ func (resp *VPNServerClientCollection) GetNextStart() (*string, error) { return start, nil } -// VPNServerClientCollectionFirst : A link to the first page of resources. -type VPNServerClientCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerClientCollectionFirst unmarshals an instance of VPNServerClientCollectionFirst from the specified map of raw messages. -func UnmarshalVPNServerClientCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerClientCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerClientCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNServerClientCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerClientCollectionNext unmarshals an instance of VPNServerClientCollectionNext from the specified map of raw messages. -func UnmarshalVPNServerClientCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerClientCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNServerCollection : VPNServerCollection struct type VPNServerCollection struct { // A link to the first page of resources. - First *VPNServerCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VPNServerCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -94043,7 +99255,7 @@ type VPNServerCollection struct { // UnmarshalVPNServerCollection unmarshals an instance of VPNServerCollection from the specified map of raw messages. func UnmarshalVPNServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNServerCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -94053,7 +99265,7 @@ func UnmarshalVPNServerCollection(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -94087,42 +99299,6 @@ func (resp *VPNServerCollection) GetNextStart() (*string, error) { return start, nil } -// VPNServerCollectionFirst : A link to the first page of resources. -type VPNServerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerCollectionFirst unmarshals an instance of VPNServerCollectionFirst from the specified map of raw messages. -func UnmarshalVPNServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNServerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerCollectionNext unmarshals an instance of VPNServerCollectionNext from the specified map of raw messages. -func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNServerHealthReason : VPNServerHealthReason struct type VPNServerHealthReason struct { // A reason code for this health state: @@ -94358,14 +99534,50 @@ func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) ( // AsPatch returns a generic map representation of the VPNServerPatch func (vpnServerPatch *VPNServerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnServerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(vpnServerPatch.Certificate) { + _patch["certificate"] = vpnServerPatch.Certificate.asPatch() + } + if !core.IsNil(vpnServerPatch.ClientAuthentication) { + var clientAuthenticationPatches []map[string]interface{} + for _, clientAuthentication := range vpnServerPatch.ClientAuthentication { + clientAuthenticationPatches = append(clientAuthenticationPatches, clientAuthentication.asPatch()) + } + _patch["client_authentication"] = clientAuthenticationPatches } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(vpnServerPatch.ClientDnsServerIps) { + var clientDnsServerIpsPatches []map[string]interface{} + for _, clientDnsServerIps := range vpnServerPatch.ClientDnsServerIps { + clientDnsServerIpsPatches = append(clientDnsServerIpsPatches, clientDnsServerIps.asPatch()) + } + _patch["client_dns_server_ips"] = clientDnsServerIpsPatches + } + if !core.IsNil(vpnServerPatch.ClientIdleTimeout) { + _patch["client_idle_timeout"] = vpnServerPatch.ClientIdleTimeout + } + if !core.IsNil(vpnServerPatch.ClientIPPool) { + _patch["client_ip_pool"] = vpnServerPatch.ClientIPPool + } + if !core.IsNil(vpnServerPatch.EnableSplitTunneling) { + _patch["enable_split_tunneling"] = vpnServerPatch.EnableSplitTunneling + } + if !core.IsNil(vpnServerPatch.Name) { + _patch["name"] = vpnServerPatch.Name + } + if !core.IsNil(vpnServerPatch.Port) { + _patch["port"] = vpnServerPatch.Port } + if !core.IsNil(vpnServerPatch.Protocol) { + _patch["protocol"] = vpnServerPatch.Protocol + } + if !core.IsNil(vpnServerPatch.Subnets) { + var subnetsPatches []map[string]interface{} + for _, subnets := range vpnServerPatch.Subnets { + subnetsPatches = append(subnetsPatches, subnets.asPatch()) + } + _patch["subnets"] = subnetsPatches + } + return } @@ -94532,14 +99744,14 @@ func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) ( // VPNServerRouteCollection : VPNServerRouteCollection struct type VPNServerRouteCollection struct { // A link to the first page of resources. - First *VPNServerRouteCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VPNServerRouteCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of routes for the VPN server. Routes []VPNServerRoute `json:"routes" validate:"required"` @@ -94551,7 +99763,7 @@ type VPNServerRouteCollection struct { // UnmarshalVPNServerRouteCollection unmarshals an instance of VPNServerRouteCollection from the specified map of raw messages. func UnmarshalVPNServerRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNServerRouteCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerRouteCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -94561,7 +99773,7 @@ func UnmarshalVPNServerRouteCollection(m map[string]json.RawMessage, result inte err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerRouteCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -94595,42 +99807,6 @@ func (resp *VPNServerRouteCollection) GetNextStart() (*string, error) { return start, nil } -// VPNServerRouteCollectionFirst : A link to the first page of resources. -type VPNServerRouteCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerRouteCollectionFirst unmarshals an instance of VPNServerRouteCollectionFirst from the specified map of raw messages. -func UnmarshalVPNServerRouteCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerRouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNServerRouteCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNServerRouteCollectionNext unmarshals an instance of VPNServerRouteCollectionNext from the specified map of raw messages. -func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNServerRouteHealthReason : VPNServerRouteHealthReason struct type VPNServerRouteHealthReason struct { // A reason code for this health state: @@ -94752,14 +99928,11 @@ func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface // AsPatch returns a generic map representation of the VPNServerRoutePatch func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnServerRoutePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(vpnServerRoutePatch.Name) { + _patch["name"] = vpnServerRoutePatch.Name } + return } @@ -94995,14 +100168,14 @@ func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result inter // VirtualNetworkInterfaceCollection : VirtualNetworkInterfaceCollection struct type VirtualNetworkInterfaceCollection struct { // A link to the first page of resources. - First *VirtualNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VirtualNetworkInterfaceCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -95014,7 +100187,7 @@ type VirtualNetworkInterfaceCollection struct { // UnmarshalVirtualNetworkInterfaceCollection unmarshals an instance of VirtualNetworkInterfaceCollection from the specified map of raw messages. func UnmarshalVirtualNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VirtualNetworkInterfaceCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVirtualNetworkInterfaceCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -95024,7 +100197,7 @@ func UnmarshalVirtualNetworkInterfaceCollection(m map[string]json.RawMessage, re err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVirtualNetworkInterfaceCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -95058,42 +100231,6 @@ func (resp *VirtualNetworkInterfaceCollection) GetNextStart() (*string, error) { return start, nil } -// VirtualNetworkInterfaceCollectionFirst : A link to the first page of resources. -type VirtualNetworkInterfaceCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceCollectionFirst unmarshals an instance of VirtualNetworkInterfaceCollectionFirst from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VirtualNetworkInterfaceCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceCollectionNext unmarshals an instance of VirtualNetworkInterfaceCollectionNext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceIPPrototype : VirtualNetworkInterfaceIPPrototype struct // Models which "extend" this model: // - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext @@ -95187,30 +100324,38 @@ type VirtualNetworkInterfacePatch struct { // region. Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. Name *string `json:"name,omitempty"` - // The protocol state filtering mode used for this virtual network interface. If `auto`, protocol state packet - // filtering is enabled or disabled based on the virtual network interface's `target` resource type: + // The protocol state filtering mode to use for this virtual network interface. If + // `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target` + // resource type: // // - `bare_metal_server_network_attachment`: disabled // - `instance_network_attachment`: enabled // - `share_mount_target`: enabled // + // Must not be `disabled` if the virtual network interface's `target` resource type is + // `share_mount_target`. + // // Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any // packets that are invalid based on the current connection state and protocol. See [Protocol state filtering - // mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering)) for more information. + // mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"` } // Constants associated with the VirtualNetworkInterfacePatch.ProtocolStateFilteringMode property. -// The protocol state filtering mode used for this virtual network interface. If `auto`, protocol state packet filtering -// is enabled or disabled based on the virtual network interface's `target` resource type: +// The protocol state filtering mode to use for this virtual network interface. If +// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target` +// resource type: // // - `bare_metal_server_network_attachment`: disabled // - `instance_network_attachment`: enabled // - `share_mount_target`: enabled // +// Must not be `disabled` if the virtual network interface's `target` resource type is +// `share_mount_target`. +// // Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any // packets that are invalid based on the current connection state and protocol. See [Protocol state filtering -// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering)) for more information. +// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. const ( VirtualNetworkInterfacePatchProtocolStateFilteringModeAutoConst = "auto" VirtualNetworkInterfacePatchProtocolStateFilteringModeDisabledConst = "disabled" @@ -95251,14 +100396,23 @@ func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result // AsPatch returns a generic map representation of the VirtualNetworkInterfacePatch func (virtualNetworkInterfacePatch *VirtualNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(virtualNetworkInterfacePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(virtualNetworkInterfacePatch.AllowIPSpoofing) { + _patch["allow_ip_spoofing"] = virtualNetworkInterfacePatch.AllowIPSpoofing } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(virtualNetworkInterfacePatch.AutoDelete) { + _patch["auto_delete"] = virtualNetworkInterfacePatch.AutoDelete } + if !core.IsNil(virtualNetworkInterfacePatch.EnableInfrastructureNat) { + _patch["enable_infrastructure_nat"] = virtualNetworkInterfacePatch.EnableInfrastructureNat + } + if !core.IsNil(virtualNetworkInterfacePatch.Name) { + _patch["name"] = virtualNetworkInterfacePatch.Name + } + if !core.IsNil(virtualNetworkInterfacePatch.ProtocolStateFilteringMode) { + _patch["protocol_state_filtering_mode"] = virtualNetworkInterfacePatch.ProtocolStateFilteringMode + } + return } @@ -95945,7 +101099,7 @@ func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result in // VolumeAttachmentDevice : VolumeAttachmentDevice struct type VolumeAttachmentDevice struct { // A unique identifier for the device which is exposed to the instance operating system. - ID *string `json:"id,omitempty"` + ID *string `json:"id" validate:"required"` } // UnmarshalVolumeAttachmentDevice unmarshals an instance of VolumeAttachmentDevice from the specified map of raw messages. @@ -95988,14 +101142,14 @@ func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interfa // AsPatch returns a generic map representation of the VolumeAttachmentPatch func (volumeAttachmentPatch *VolumeAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(volumeAttachmentPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(volumeAttachmentPatch.DeleteVolumeOnInstanceDelete) { + _patch["delete_volume_on_instance_delete"] = volumeAttachmentPatch.DeleteVolumeOnInstanceDelete } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(volumeAttachmentPatch.Name) { + _patch["name"] = volumeAttachmentPatch.Name } + return } @@ -96491,14 +101645,14 @@ func UnmarshalVolumeCatalogOffering(m map[string]json.RawMessage, result interfa // VolumeCollection : VolumeCollection struct type VolumeCollection struct { // A link to the first page of resources. - First *VolumeCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VolumeCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -96510,7 +101664,7 @@ type VolumeCollection struct { // UnmarshalVolumeCollection unmarshals an instance of VolumeCollection from the specified map of raw messages. func UnmarshalVolumeCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VolumeCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -96520,7 +101674,7 @@ func UnmarshalVolumeCollection(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -96554,42 +101708,6 @@ func (resp *VolumeCollection) GetNextStart() (*string, error) { return start, nil } -// VolumeCollectionFirst : A link to the first page of resources. -type VolumeCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVolumeCollectionFirst unmarshals an instance of VolumeCollectionFirst from the specified map of raw messages. -func UnmarshalVolumeCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VolumeCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVolumeCollectionNext unmarshals an instance of VolumeCollectionNext from the specified map of raw messages. -func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VolumeHealthReason : VolumeHealthReason struct type VolumeHealthReason struct { // A reason code for this health state. @@ -96746,14 +101864,23 @@ func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err // AsPatch returns a generic map representation of the VolumePatch func (volumePatch *VolumePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(volumePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + _patch = map[string]interface{}{} + if !core.IsNil(volumePatch.Capacity) { + _patch["capacity"] = volumePatch.Capacity } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(volumePatch.Iops) { + _patch["iops"] = volumePatch.Iops + } + if !core.IsNil(volumePatch.Name) { + _patch["name"] = volumePatch.Name } + if !core.IsNil(volumePatch.Profile) { + _patch["profile"] = volumePatch.Profile.asPatch() + } + if !core.IsNil(volumePatch.UserTags) { + _patch["user_tags"] = volumePatch.UserTags + } + return } @@ -97099,14 +102226,14 @@ func UnmarshalVolumeProfileCapacity(m map[string]json.RawMessage, result interfa // VolumeProfileCollection : VolumeProfileCollection struct type VolumeProfileCollection struct { // A link to the first page of resources. - First *VolumeProfileCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *VolumeProfileCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of volume profiles. Profiles []VolumeProfile `json:"profiles" validate:"required"` @@ -97118,7 +102245,7 @@ type VolumeProfileCollection struct { // UnmarshalVolumeProfileCollection unmarshals an instance of VolumeProfileCollection from the specified map of raw messages. func UnmarshalVolumeProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VolumeProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeProfileCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -97128,7 +102255,7 @@ func UnmarshalVolumeProfileCollection(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeProfileCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -97162,42 +102289,6 @@ func (resp *VolumeProfileCollection) GetNextStart() (*string, error) { return start, nil } -// VolumeProfileCollectionFirst : A link to the first page of resources. -type VolumeProfileCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVolumeProfileCollectionFirst unmarshals an instance of VolumeProfileCollectionFirst from the specified map of raw messages. -func UnmarshalVolumeProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VolumeProfileCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVolumeProfileCollectionNext unmarshals an instance of VolumeProfileCollectionNext from the specified map of raw messages. -func UnmarshalVolumeProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VolumeProfileIops : VolumeProfileIops struct // Models which "extend" this model: // - VolumeProfileIopsFixed @@ -97301,6 +102392,7 @@ func (*VolumeProfileIdentity) isaVolumeProfileIdentity() bool { type VolumeProfileIdentityIntf interface { isaVolumeProfileIdentity() bool + asPatch() map[string]interface{} } // UnmarshalVolumeProfileIdentity unmarshals an instance of VolumeProfileIdentity from the specified map of raw messages. @@ -97320,6 +102412,19 @@ func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interfa return } +// asPatch returns a generic map representation of the VolumeProfileIdentity +func (volumeProfileIdentity *VolumeProfileIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(volumeProfileIdentity.Name) { + _patch["name"] = volumeProfileIdentity.Name + } + if !core.IsNil(volumeProfileIdentity.Href) { + _patch["href"] = volumeProfileIdentity.Href + } + + return +} + // VolumeProfileReference : VolumeProfileReference struct type VolumeProfileReference struct { // The URL for this volume profile. @@ -97837,42 +102942,6 @@ func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{ return } -// VpcdnsResolutionBindingCollectionFirst : A link to the first page of resources. -type VpcdnsResolutionBindingCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVpcdnsResolutionBindingCollectionFirst unmarshals an instance of VpcdnsResolutionBindingCollectionFirst from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolutionBindingCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VpcdnsResolutionBindingCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVpcdnsResolutionBindingCollectionNext unmarshals an instance of VpcdnsResolutionBindingCollectionNext from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // Zone : Zone struct type Zone struct { // The physical data center assigned to this logical zone. @@ -97997,6 +103066,7 @@ func (*ZoneIdentity) isaZoneIdentity() bool { type ZoneIdentityIntf interface { isaZoneIdentity() bool + asPatch() map[string]interface{} } // UnmarshalZoneIdentity unmarshals an instance of ZoneIdentity from the specified map of raw messages. @@ -98016,6 +103086,19 @@ func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (er return } +// asPatch returns a generic map representation of the ZoneIdentity +func (zoneIdentity *ZoneIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(zoneIdentity.Name) { + _patch["name"] = zoneIdentity.Name + } + if !core.IsNil(zoneIdentity.Href) { + _patch["href"] = zoneIdentity.Href + } + + return +} + // ZoneReference : ZoneReference struct type ZoneReference struct { // The URL for this zone. @@ -102685,6 +107768,16 @@ func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, res return } +// asPatch returns a generic map representation of the CertificateInstanceIdentityByCRN +func (certificateInstanceIdentityByCRN *CertificateInstanceIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(certificateInstanceIdentityByCRN.CRN) { + _patch["crn"] = certificateInstanceIdentityByCRN.CRN + } + + return +} + // CloudObjectStorageBucketIdentityByCRN : CloudObjectStorageBucketIdentityByCRN struct // This model "extends" CloudObjectStorageBucketIdentity type CloudObjectStorageBucketIdentityByCRN struct { @@ -102755,6 +107848,481 @@ func UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityBy return } +// ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext : Identifies a cluster network subnet reserved IP by a unique property. Required if `subnet` is not specified. The +// cluster network subnet reserved IP must be currently unbound. +// Models which "extend" this model: +// - ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID +// - ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref +// This model "extends" ClusterNetworkInterfacePrimaryIPPrototype +type ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext struct { + // The unique identifier for this cluster network subnet reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this cluster network subnet reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext) isaClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext() bool { + return true +} + +type ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextIntf interface { + ClusterNetworkInterfacePrimaryIPPrototypeIntf + isaClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext() bool +} + +func (*ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext) isaClusterNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext unmarshals an instance of ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext : The prototype for a new cluster network subnet reserved IP. Requires `subnet` to be specified. +// This model "extends" ClusterNetworkInterfacePrimaryIPPrototype +type ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext struct { + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target` + // is deleted, or the cluster network subnet reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this cluster network subnet reserved IP. The name must not be used by another reserved IP in the + // cluster network subnet. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. + // If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` +} + +func (*ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) isaClusterNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext unmarshals an instance of ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext : ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext struct +// This model "extends" ClusterNetworkInterfaceTarget +type ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext struct { + // The URL for this instance cluster network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance cluster network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance cluster network attachment. The name is unique across all network attachments for the + // instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext.ResourceType property. +// The resource type. +const ( + ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContextResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment" +) + +func (*ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext) isaClusterNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext unmarshals an instance of ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkProfileIdentityByHref : ClusterNetworkProfileIdentityByHref struct +// This model "extends" ClusterNetworkProfileIdentity +type ClusterNetworkProfileIdentityByHref struct { + // The URL for this cluster network profile. + Href *string `json:"href" validate:"required"` +} + +// NewClusterNetworkProfileIdentityByHref : Instantiate ClusterNetworkProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewClusterNetworkProfileIdentityByHref(href string) (_model *ClusterNetworkProfileIdentityByHref, err error) { + _model = &ClusterNetworkProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ClusterNetworkProfileIdentityByHref) isaClusterNetworkProfileIdentity() bool { + return true +} + +// UnmarshalClusterNetworkProfileIdentityByHref unmarshals an instance of ClusterNetworkProfileIdentityByHref from the specified map of raw messages. +func UnmarshalClusterNetworkProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkProfileIdentityByName : ClusterNetworkProfileIdentityByName struct +// This model "extends" ClusterNetworkProfileIdentity +type ClusterNetworkProfileIdentityByName struct { + // The globally unique name for this cluster network profile. + Name *string `json:"name" validate:"required"` +} + +// NewClusterNetworkProfileIdentityByName : Instantiate ClusterNetworkProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewClusterNetworkProfileIdentityByName(name string) (_model *ClusterNetworkProfileIdentityByName, err error) { + _model = &ClusterNetworkProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ClusterNetworkProfileIdentityByName) isaClusterNetworkProfileIdentity() bool { + return true +} + +// UnmarshalClusterNetworkProfileIdentityByName unmarshals an instance of ClusterNetworkProfileIdentityByName from the specified map of raw messages. +func UnmarshalClusterNetworkProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetIdentityByHref : ClusterNetworkSubnetIdentityByHref struct +// This model "extends" ClusterNetworkSubnetIdentity +type ClusterNetworkSubnetIdentityByHref struct { + // The URL for this cluster network subnet. + Href *string `json:"href" validate:"required"` +} + +// NewClusterNetworkSubnetIdentityByHref : Instantiate ClusterNetworkSubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewClusterNetworkSubnetIdentityByHref(href string) (_model *ClusterNetworkSubnetIdentityByHref, err error) { + _model = &ClusterNetworkSubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ClusterNetworkSubnetIdentityByHref) isaClusterNetworkSubnetIdentity() bool { + return true +} + +// UnmarshalClusterNetworkSubnetIdentityByHref unmarshals an instance of ClusterNetworkSubnetIdentityByHref from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetIdentityByID : ClusterNetworkSubnetIdentityByID struct +// This model "extends" ClusterNetworkSubnetIdentity +type ClusterNetworkSubnetIdentityByID struct { + // The unique identifier for this cluster network subnet. + ID *string `json:"id" validate:"required"` +} + +// NewClusterNetworkSubnetIdentityByID : Instantiate ClusterNetworkSubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewClusterNetworkSubnetIdentityByID(id string) (_model *ClusterNetworkSubnetIdentityByID, err error) { + _model = &ClusterNetworkSubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ClusterNetworkSubnetIdentityByID) isaClusterNetworkSubnetIdentity() bool { + return true +} + +// UnmarshalClusterNetworkSubnetIdentityByID unmarshals an instance of ClusterNetworkSubnetIdentityByID from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype : ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype struct +// This model "extends" ClusterNetworkSubnetPrototype +type ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype struct { + // The IP version(s) to support for this cluster network subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this cluster network subnet. The name must not be used by another cluster network subnet in the cluster + // network. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The IPv4 range of the cluster network subnet, expressed in CIDR format. The prefix length of the cluster network + // subnet's CIDR must be between `/8` (16,777,216 addresses) and `/29` + // (8 addresses). The IPv4 range of the cluster network subnet's CIDR must be within the cluster network's + // `subnet_prefixes`. + // + // The range must not overlap with any of the following reserved address ranges: + // + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses). + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` +} + +// Constants associated with the ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype.IPVersion property. +// The IP version(s) to support for this cluster network subnet. +const ( + ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototypeIPVersionIpv4Const = "ipv4" +) + +// NewClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype : Instantiate ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype (Generic Model Constructor) +func (*VpcV1) NewClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype(ipv4CIDRBlock string) (_model *ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype, err error) { + _model = &ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype{ + Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype) isaClusterNetworkSubnetPrototype() bool { + return true +} + +// UnmarshalClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype unmarshals an instance of ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + err = core.SDKErrorf(err, "", "ipv4_cidr_block-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype : ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype struct +// This model "extends" ClusterNetworkSubnetPrototype +type ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype struct { + // The IP version(s) to support for this cluster network subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this cluster network subnet. The name must not be used by another cluster network subnet in the cluster + // network. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The total number of IPv4 addresses required. Must be a power of 2. + // + // A CIDR will be allocated from a subnet prefix in the cluster network that has an + // `allocation_policy` of `auto`. There must be a subnet prefix that has a free CIDR range with at least this number of + // addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` +} + +// Constants associated with the ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype.IPVersion property. +// The IP version(s) to support for this cluster network subnet. +const ( + ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototypeIPVersionIpv4Const = "ipv4" +) + +// NewClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype : Instantiate ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype (Generic Model Constructor) +func (*VpcV1) NewClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype(totalIpv4AddressCount int64) (_model *ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype, err error) { + _model = &ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype{ + TotalIpv4AddressCount: core.Int64Ptr(totalIpv4AddressCount), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) isaClusterNetworkSubnetPrototype() bool { + return true +} + +// UnmarshalClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype unmarshals an instance of ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext : ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext struct +// This model "extends" ClusterNetworkSubnetReservedIPTarget +type ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` + + // The URL for this cluster network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this cluster network interface. + ID *string `json:"id" validate:"required"` + + // The name for this cluster network interface. The name is unique across all interfaces in the cluster network. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContextResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" +) + +func (*ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext) isaClusterNetworkSubnetReservedIPTarget() bool { + return true +} + +// UnmarshalClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext unmarshals an instance of ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext from the specified map of raw messages. +func UnmarshalClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DnsInstanceIdentityByCRN : DnsInstanceIdentityByCRN struct // This model "extends" DnsInstanceIdentity type DnsInstanceIdentityByCRN struct { @@ -102790,6 +108358,16 @@ func UnmarshalDnsInstanceIdentityByCRN(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the DnsInstanceIdentityByCRN +func (dnsInstanceIdentityByCRN *DnsInstanceIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(dnsInstanceIdentityByCRN.CRN) { + _patch["crn"] = dnsInstanceIdentityByCRN.CRN + } + + return +} + // DnsZoneIdentityByID : DnsZoneIdentityByID struct // This model "extends" DnsZoneIdentity type DnsZoneIdentityByID struct { @@ -102824,6 +108402,16 @@ func UnmarshalDnsZoneIdentityByID(m map[string]json.RawMessage, result interface return } +// asPatch returns a generic map representation of the DnsZoneIdentityByID +func (dnsZoneIdentityByID *DnsZoneIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(dnsZoneIdentityByID.ID) { + _patch["id"] = dnsZoneIdentityByID.ID + } + + return +} + // DedicatedHostGroupIdentityByCRN : DedicatedHostGroupIdentityByCRN struct // This model "extends" DedicatedHostGroupIdentity type DedicatedHostGroupIdentityByCRN struct { @@ -103695,6 +109283,16 @@ func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result in return } +// asPatch returns a generic map representation of the EncryptionKeyIdentityByCRN +func (encryptionKeyIdentityByCRN *EncryptionKeyIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(encryptionKeyIdentityByCRN.CRN) { + _patch["crn"] = encryptionKeyIdentityByCRN.CRN + } + + return +} + // EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. // Models which "extend" this model: // - EndpointGatewayReservedIPReservedIPIdentityByID @@ -104269,6 +109867,19 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity +func (floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity.ID) { + _patch["id"] = floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity.ID + } + if !core.IsNil(floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity.Href) { + _patch["href"] = floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity.Href + } + + return +} + // FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID @@ -104321,6 +109932,19 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.Ra return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchNetworkInterfaceIdentity +func (floatingIPTargetPatchNetworkInterfaceIdentity *FloatingIPTargetPatchNetworkInterfaceIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchNetworkInterfaceIdentity.ID) { + _patch["id"] = floatingIPTargetPatchNetworkInterfaceIdentity.ID + } + if !core.IsNil(floatingIPTargetPatchNetworkInterfaceIdentity.Href) { + _patch["href"] = floatingIPTargetPatchNetworkInterfaceIdentity.Href + } + + return +} + // FloatingIPTargetPatchVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID @@ -104373,6 +109997,22 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string] return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +func (floatingIPTargetPatchVirtualNetworkInterfaceIdentity *FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchVirtualNetworkInterfaceIdentity.ID) { + _patch["id"] = floatingIPTargetPatchVirtualNetworkInterfaceIdentity.ID + } + if !core.IsNil(floatingIPTargetPatchVirtualNetworkInterfaceIdentity.Href) { + _patch["href"] = floatingIPTargetPatchVirtualNetworkInterfaceIdentity.Href + } + if !core.IsNil(floatingIPTargetPatchVirtualNetworkInterfaceIdentity.CRN) { + _patch["crn"] = floatingIPTargetPatchVirtualNetworkInterfaceIdentity.CRN + } + + return +} + // FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID @@ -105978,6 +111618,179 @@ func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[str return } +// InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref : InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref struct +// This model "extends" InstanceClusterNetworkAttachmentBeforePrototype +type InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref struct { + // The URL for this instance cluster network attachment. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref : Instantiate InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref(href string) (_model *InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref, err error) { + _model = &InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref) isaInstanceClusterNetworkAttachmentBeforePrototype() bool { + return true +} + +// UnmarshalInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref unmarshals an instance of InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID : InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID struct +// This model "extends" InstanceClusterNetworkAttachmentBeforePrototype +type InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID struct { + // The unique identifier for this instance cluster network attachment. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID : Instantiate InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID(id string) (_model *InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID, err error) { + _model = &InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) isaInstanceClusterNetworkAttachmentBeforePrototype() bool { + return true +} + +// UnmarshalInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID unmarshals an instance of InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity : Identifies a cluster network interface by a unique property. +// Models which "extend" this model: +// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID +// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref +// This model "extends" InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface +type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity struct { + // The unique identifier for this cluster network interface. + ID *string `json:"id,omitempty"` + + // The URL for this cluster network interface. + Href *string `json:"href,omitempty"` +} + +func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity() bool { + return true +} + +type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityIntf interface { + InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf + isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity() bool +} + +func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface() bool { + return true +} + +// UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity unmarshals an instance of InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment : The cluster network interface for this target. +// This model "extends" InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface +type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment struct { + // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this cluster network interface. The name must not be used by another interface in the cluster network. + // Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the cluster network interface. May be either + // a cluster network subnet reserved IP identity, or a cluster network subnet reserved IP + // prototype object which will be used to create a new cluster network subnet reserved IP. + // + // If a cluster network subnet reserved IP identity is provided, the specified cluster + // network subnet reserved IP must be unbound. + // + // If a cluster network subnet reserved IP prototype object with an address is provided, + // the address must be available on the cluster network interface's cluster network + // subnet. If no address is specified, an available address on the cluster network subnet + // will be automatically selected and reserved. + PrimaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The associated cluster network subnet. Required if `primary_ip` does not specify a + // cluster network subnet reserved IP identity. + Subnet ClusterNetworkSubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface() bool { + return true +} + +// UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment unmarshals an instance of InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkInterfacePrimaryIPPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceGroupManagerActionPrototypeScheduledActionPrototype : InstanceGroupManagerActionPrototypeScheduledActionPrototype struct // Models which "extend" this model: // - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt @@ -107135,6 +112948,16 @@ func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]jso return } +// asPatch returns a generic map representation of the InstancePatchProfileInstanceProfileIdentityByHref +func (instancePatchProfileInstanceProfileIdentityByHref *InstancePatchProfileInstanceProfileIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePatchProfileInstanceProfileIdentityByHref.Href) { + _patch["href"] = instancePatchProfileInstanceProfileIdentityByHref.Href + } + + return +} + // InstancePatchProfileInstanceProfileIdentityByName : InstancePatchProfileInstanceProfileIdentityByName struct // This model "extends" InstancePatchProfile type InstancePatchProfileInstanceProfileIdentityByName struct { @@ -107170,6 +112993,16 @@ func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]jso return } +// asPatch returns a generic map representation of the InstancePatchProfileInstanceProfileIdentityByName +func (instancePatchProfileInstanceProfileIdentityByName *InstancePatchProfileInstanceProfileIdentityByName) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePatchProfileInstanceProfileIdentityByName.Name) { + _patch["name"] = instancePatchProfileInstanceProfileIdentityByName.Name + } + + return +} + // InstancePlacementTargetPatchDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. // Models which "extend" this model: // - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID @@ -107222,6 +113055,22 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity(m map[strin return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatchDedicatedHostGroupIdentity +func (instancePlacementTargetPatchDedicatedHostGroupIdentity *InstancePlacementTargetPatchDedicatedHostGroupIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatchDedicatedHostGroupIdentity.ID) { + _patch["id"] = instancePlacementTargetPatchDedicatedHostGroupIdentity.ID + } + if !core.IsNil(instancePlacementTargetPatchDedicatedHostGroupIdentity.CRN) { + _patch["crn"] = instancePlacementTargetPatchDedicatedHostGroupIdentity.CRN + } + if !core.IsNil(instancePlacementTargetPatchDedicatedHostGroupIdentity.Href) { + _patch["href"] = instancePlacementTargetPatchDedicatedHostGroupIdentity.Href + } + + return +} + // InstancePlacementTargetPatchDedicatedHostIdentity : Identifies a dedicated host by a unique property. // Models which "extend" this model: // - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID @@ -107274,6 +113123,22 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity(m map[string]jso return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatchDedicatedHostIdentity +func (instancePlacementTargetPatchDedicatedHostIdentity *InstancePlacementTargetPatchDedicatedHostIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatchDedicatedHostIdentity.ID) { + _patch["id"] = instancePlacementTargetPatchDedicatedHostIdentity.ID + } + if !core.IsNil(instancePlacementTargetPatchDedicatedHostIdentity.CRN) { + _patch["crn"] = instancePlacementTargetPatchDedicatedHostIdentity.CRN + } + if !core.IsNil(instancePlacementTargetPatchDedicatedHostIdentity.Href) { + _patch["href"] = instancePlacementTargetPatchDedicatedHostIdentity.Href + } + + return +} + // InstancePlacementTargetPrototypeDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. // Models which "extend" this model: // - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID @@ -107816,6 +113681,132 @@ func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result return } +// InstanceProfileClusterNetworkAttachmentCountDependent : The number of cluster network attachments supported on an instance with this profile is dependent on its +// configuration. +// This model "extends" InstanceProfileClusterNetworkAttachmentCount +type InstanceProfileClusterNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileClusterNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileClusterNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileClusterNetworkAttachmentCountDependent) isaInstanceProfileClusterNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileClusterNetworkAttachmentCountDependent unmarshals an instance of InstanceProfileClusterNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileClusterNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileClusterNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileClusterNetworkAttachmentCountEnum : The permitted values for cluster network attachment count for an instance with this profile. +// This model "extends" InstanceProfileClusterNetworkAttachmentCount +type InstanceProfileClusterNetworkAttachmentCountEnum struct { + Default *int64 `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileClusterNetworkAttachmentCountEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileClusterNetworkAttachmentCountEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileClusterNetworkAttachmentCountEnum) isaInstanceProfileClusterNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileClusterNetworkAttachmentCountEnum unmarshals an instance of InstanceProfileClusterNetworkAttachmentCountEnum from the specified map of raw messages. +func UnmarshalInstanceProfileClusterNetworkAttachmentCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileClusterNetworkAttachmentCountEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileClusterNetworkAttachmentCountRange : The number of network attachments supported on an instance with this profile. +// This model "extends" InstanceProfileClusterNetworkAttachmentCount +type InstanceProfileClusterNetworkAttachmentCountRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + Step *int64 `json:"step,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileClusterNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + InstanceProfileClusterNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*InstanceProfileClusterNetworkAttachmentCountRange) isaInstanceProfileClusterNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileClusterNetworkAttachmentCountRange unmarshals an instance of InstanceProfileClusterNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalInstanceProfileClusterNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileClusterNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileDiskQuantityDependent : The number of disks of this configuration for an instance with this profile depends on its instance configuration. // This model "extends" InstanceProfileDiskQuantity type InstanceProfileDiskQuantityDependent struct { @@ -109384,6 +115375,11 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -109513,6 +115509,11 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -109633,6 +115634,11 @@ type InstancePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -109756,6 +115762,11 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -109874,6 +115885,11 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -109994,6 +116010,11 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -110110,6 +116131,11 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -110250,6 +116276,11 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -110378,6 +116409,11 @@ type InstancePrototypeInstanceByVolume struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -110498,6 +116534,11 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -110637,6 +116678,16 @@ func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the InstanceTemplateIdentityByCRN +func (instanceTemplateIdentityByCRN *InstanceTemplateIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceTemplateIdentityByCRN.CRN) { + _patch["crn"] = instanceTemplateIdentityByCRN.CRN + } + + return +} + // InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct // This model "extends" InstanceTemplateIdentity type InstanceTemplateIdentityByHref struct { @@ -110672,6 +116723,16 @@ func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, resul return } +// asPatch returns a generic map representation of the InstanceTemplateIdentityByHref +func (instanceTemplateIdentityByHref *InstanceTemplateIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceTemplateIdentityByHref.Href) { + _patch["href"] = instanceTemplateIdentityByHref.Href + } + + return +} + // InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct // This model "extends" InstanceTemplateIdentity type InstanceTemplateIdentityByID struct { @@ -110707,6 +116768,16 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the InstanceTemplateIdentityByID +func (instanceTemplateIdentityByID *InstanceTemplateIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instanceTemplateIdentityByID.ID) { + _patch["id"] = instanceTemplateIdentityByID.ID + } + + return +} + // InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. // Models which "extend" this model: // - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment @@ -110716,6 +116787,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -110843,6 +116919,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -110963,6 +117044,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -111084,6 +117170,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -111202,6 +117293,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -111320,6 +117416,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -111436,6 +117537,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -111574,6 +117680,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -111702,6 +117813,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -111841,6 +117957,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -111979,6 +118100,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -112112,6 +118238,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -112250,6 +118381,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -112380,6 +118516,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -112715,6 +118856,16 @@ func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result int return } +// asPatch returns a generic map representation of the LoadBalancerIdentityByCRN +func (loadBalancerIdentityByCRN *LoadBalancerIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerIdentityByCRN.CRN) { + _patch["crn"] = loadBalancerIdentityByCRN.CRN + } + + return +} + // LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct // This model "extends" LoadBalancerIdentity type LoadBalancerIdentityByHref struct { @@ -112750,6 +118901,16 @@ func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result in return } +// asPatch returns a generic map representation of the LoadBalancerIdentityByHref +func (loadBalancerIdentityByHref *LoadBalancerIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerIdentityByHref.Href) { + _patch["href"] = loadBalancerIdentityByHref.Href + } + + return +} + // LoadBalancerIdentityByID : LoadBalancerIdentityByID struct // This model "extends" LoadBalancerIdentity type LoadBalancerIdentityByID struct { @@ -112785,6 +118946,16 @@ func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the LoadBalancerIdentityByID +func (loadBalancerIdentityByID *LoadBalancerIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerIdentityByID.ID) { + _patch["id"] = loadBalancerIdentityByID.ID + } + + return +} + // LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerDefaultPoolPatch type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct { @@ -112820,6 +118991,16 @@ func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref return } +// asPatch returns a generic map representation of the LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref +func (loadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref *LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref.Href) { + _patch["href"] = loadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref.Href + } + + return +} + // LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerListenerDefaultPoolPatch type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID struct { @@ -112855,6 +119036,16 @@ func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(m return } +// asPatch returns a generic map representation of the LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID +func (loadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID *LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID.ID) { + _patch["id"] = loadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID.ID + } + + return +} + // LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct // This model "extends" LoadBalancerListenerIdentity type LoadBalancerListenerIdentityByHref struct { @@ -112890,6 +119081,16 @@ func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, r return } +// asPatch returns a generic map representation of the LoadBalancerListenerIdentityByHref +func (loadBalancerListenerIdentityByHref *LoadBalancerListenerIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerIdentityByHref.Href) { + _patch["href"] = loadBalancerListenerIdentityByHref.Href + } + + return +} + // LoadBalancerListenerIdentityByID : LoadBalancerListenerIdentityByID struct // This model "extends" LoadBalancerListenerIdentity type LoadBalancerListenerIdentityByID struct { @@ -112925,6 +119126,16 @@ func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, res return } +// asPatch returns a generic map representation of the LoadBalancerListenerIdentityByID +func (loadBalancerListenerIdentityByID *LoadBalancerListenerIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerIdentityByID.ID) { + _patch["id"] = loadBalancerListenerIdentityByID.ID + } + + return +} + // LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch struct // This model "extends" LoadBalancerListenerPolicyTargetPatch type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch struct { @@ -112964,6 +119175,22 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTT return } +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch +func (loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch.HTTPStatusCode) { + _patch["http_status_code"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch.HTTPStatusCode + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch.Listener) { + _patch["listener"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch.Listener.asPatch() + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch.URI) { + _patch["uri"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch.URI + } + + return +} + // LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct // This model "extends" LoadBalancerListenerPolicyTargetPatch type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { @@ -113011,6 +119238,19 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRed return } +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch +func (loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch *LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch.HTTPStatusCode) { + _patch["http_status_code"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch.HTTPStatusCode + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch.URL) { + _patch["url"] = loadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch.URL + } + + return +} + // LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID @@ -113054,6 +119294,19 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m ma return } +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +func (loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity.ID) { + _patch["id"] = loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity.ID + } + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity.Href) { + _patch["href"] = loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity.Href + } + + return +} + // LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype struct // This model "extends" LoadBalancerListenerPolicyTargetPrototype type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype struct { @@ -113377,6 +119630,16 @@ func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[strin return } +// asPatch returns a generic map representation of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +func (loadBalancerPoolIdentityLoadBalancerPoolIdentityByHref *LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolIdentityLoadBalancerPoolIdentityByHref.Href) { + _patch["href"] = loadBalancerPoolIdentityLoadBalancerPoolIdentityByHref.Href + } + + return +} + // LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerPoolIdentity type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { @@ -113412,6 +119675,16 @@ func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string] return } +// asPatch returns a generic map representation of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +func (loadBalancerPoolIdentityLoadBalancerPoolIdentityByID *LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolIdentityLoadBalancerPoolIdentityByID.ID) { + _patch["id"] = loadBalancerPoolIdentityLoadBalancerPoolIdentityByID.ID + } + + return +} + // LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct // This model "extends" LoadBalancerPoolMemberTargetPrototype type LoadBalancerPoolMemberTargetPrototypeIP struct { @@ -113450,6 +119723,16 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessa return } +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeIP +func (loadBalancerPoolMemberTargetPrototypeIP *LoadBalancerPoolMemberTargetPrototypeIP) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeIP.Address) { + _patch["address"] = loadBalancerPoolMemberTargetPrototypeIP.Address + } + + return +} + // LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. // Models which "extend" this model: // - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID @@ -113502,6 +119785,22 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string return } +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +func (loadBalancerPoolMemberTargetPrototypeInstanceIdentity *LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeInstanceIdentity.ID) { + _patch["id"] = loadBalancerPoolMemberTargetPrototypeInstanceIdentity.ID + } + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeInstanceIdentity.CRN) { + _patch["crn"] = loadBalancerPoolMemberTargetPrototypeInstanceIdentity.CRN + } + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeInstanceIdentity.Href) { + _patch["href"] = loadBalancerPoolMemberTargetPrototypeInstanceIdentity.Href + } + + return +} + // LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct // This model "extends" LoadBalancerPoolMemberTarget type LoadBalancerPoolMemberTargetIP struct { @@ -114104,6 +120403,16 @@ func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result inter return } +// asPatch returns a generic map representation of the NetworkACLIdentityByCRN +func (networkACLIdentityByCRN *NetworkACLIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLIdentityByCRN.CRN) { + _patch["crn"] = networkACLIdentityByCRN.CRN + } + + return +} + // NetworkACLIdentityByHref : NetworkACLIdentityByHref struct // This model "extends" NetworkACLIdentity type NetworkACLIdentityByHref struct { @@ -114139,6 +120448,16 @@ func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the NetworkACLIdentityByHref +func (networkACLIdentityByHref *NetworkACLIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLIdentityByHref.Href) { + _patch["href"] = networkACLIdentityByHref.Href + } + + return +} + // NetworkACLIdentityByID : NetworkACLIdentityByID struct // This model "extends" NetworkACLIdentity type NetworkACLIdentityByID struct { @@ -114174,6 +120493,16 @@ func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interf return } +// asPatch returns a generic map representation of the NetworkACLIdentityByID +func (networkACLIdentityByID *NetworkACLIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLIdentityByID.ID) { + _patch["id"] = networkACLIdentityByID.ID + } + + return +} + // NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct // This model "extends" NetworkACLPrototype type NetworkACLPrototypeNetworkACLByRules struct { @@ -114329,6 +120658,16 @@ func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string return } +// asPatch returns a generic map representation of the NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref +func (networkACLRuleBeforePatchNetworkACLRuleIdentityByHref *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLRuleBeforePatchNetworkACLRuleIdentityByHref.Href) { + _patch["href"] = networkACLRuleBeforePatchNetworkACLRuleIdentityByHref.Href + } + + return +} + // NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct // This model "extends" NetworkACLRuleBeforePatch type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { @@ -114364,6 +120703,16 @@ func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]j return } +// asPatch returns a generic map representation of the NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID +func (networkACLRuleBeforePatchNetworkACLRuleIdentityByID *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(networkACLRuleBeforePatchNetworkACLRuleIdentityByID.ID) { + _patch["id"] = networkACLRuleBeforePatchNetworkACLRuleIdentityByID.ID + } + + return +} + // NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct // This model "extends" NetworkACLRuleBeforePrototype type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { @@ -116519,6 +122868,16 @@ func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interfac return } +// asPatch returns a generic map representation of the RegionIdentityByHref +func (regionIdentityByHref *RegionIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(regionIdentityByHref.Href) { + _patch["href"] = regionIdentityByHref.Href + } + + return +} + // RegionIdentityByName : RegionIdentityByName struct // This model "extends" RegionIdentity type RegionIdentityByName struct { @@ -116554,6 +122913,16 @@ func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interfac return } +// asPatch returns a generic map representation of the RegionIdentityByName +func (regionIdentityByName *RegionIdentityByName) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(regionIdentityByName.Name) { + _patch["name"] = regionIdentityByName.Name + } + + return +} + // ReservationIdentityByCRN : ReservationIdentityByCRN struct // This model "extends" ReservationIdentity type ReservationIdentityByCRN struct { @@ -116589,6 +122958,16 @@ func UnmarshalReservationIdentityByCRN(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the ReservationIdentityByCRN +func (reservationIdentityByCRN *ReservationIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(reservationIdentityByCRN.CRN) { + _patch["crn"] = reservationIdentityByCRN.CRN + } + + return +} + // ReservationIdentityByHref : ReservationIdentityByHref struct // This model "extends" ReservationIdentity type ReservationIdentityByHref struct { @@ -116624,6 +123003,16 @@ func UnmarshalReservationIdentityByHref(m map[string]json.RawMessage, result int return } +// asPatch returns a generic map representation of the ReservationIdentityByHref +func (reservationIdentityByHref *ReservationIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(reservationIdentityByHref.Href) { + _patch["href"] = reservationIdentityByHref.Href + } + + return +} + // ReservationIdentityByID : ReservationIdentityByID struct // This model "extends" ReservationIdentity type ReservationIdentityByID struct { @@ -116659,6 +123048,16 @@ func UnmarshalReservationIdentityByID(m map[string]json.RawMessage, result inter return } +// asPatch returns a generic map representation of the ReservationIdentityByID +func (reservationIdentityByID *ReservationIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(reservationIdentityByID.ID) { + _patch["id"] = reservationIdentityByID.ID + } + + return +} + // ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct // Models which "extend" this model: // - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID @@ -117531,6 +123930,16 @@ func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, resu return } +// asPatch returns a generic map representation of the RouteNextHopPatchRouteNextHopIP +func (routeNextHopPatchRouteNextHopIP *RouteNextHopPatchRouteNextHopIP) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routeNextHopPatchRouteNextHopIP.Address) { + _patch["address"] = routeNextHopPatchRouteNextHopIP.Address + } + + return +} + // RouteNextHopPatchVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. // Models which "extend" this model: // - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID @@ -117574,6 +123983,19 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.Ra return } +// asPatch returns a generic map representation of the RouteNextHopPatchVPNGatewayConnectionIdentity +func (routeNextHopPatchVPNGatewayConnectionIdentity *RouteNextHopPatchVPNGatewayConnectionIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routeNextHopPatchVPNGatewayConnectionIdentity.ID) { + _patch["id"] = routeNextHopPatchVPNGatewayConnectionIdentity.ID + } + if !core.IsNil(routeNextHopPatchVPNGatewayConnectionIdentity.Href) { + _patch["href"] = routeNextHopPatchVPNGatewayConnectionIdentity.Href + } + + return +} + // RouteNextHopPrototypeRouteNextHopIP : RouteNextHopPrototypeRouteNextHopIP struct // Models which "extend" this model: // - RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP @@ -117752,6 +124174,16 @@ func UnmarshalRoutingTableIdentityByCRN(m map[string]json.RawMessage, result int return } +// asPatch returns a generic map representation of the RoutingTableIdentityByCRN +func (routingTableIdentityByCRN *RoutingTableIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routingTableIdentityByCRN.CRN) { + _patch["crn"] = routingTableIdentityByCRN.CRN + } + + return +} + // RoutingTableIdentityByHref : RoutingTableIdentityByHref struct // This model "extends" RoutingTableIdentity type RoutingTableIdentityByHref struct { @@ -117787,6 +124219,16 @@ func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result in return } +// asPatch returns a generic map representation of the RoutingTableIdentityByHref +func (routingTableIdentityByHref *RoutingTableIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routingTableIdentityByHref.Href) { + _patch["href"] = routingTableIdentityByHref.Href + } + + return +} + // RoutingTableIdentityByID : RoutingTableIdentityByID struct // This model "extends" RoutingTableIdentity type RoutingTableIdentityByID struct { @@ -117822,6 +124264,16 @@ func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result inte return } +// asPatch returns a generic map representation of the RoutingTableIdentityByID +func (routingTableIdentityByID *RoutingTableIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routingTableIdentityByID.ID) { + _patch["id"] = routingTableIdentityByID.ID + } + + return +} + // SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct // This model "extends" SecurityGroupIdentity type SecurityGroupIdentityByCRN struct { @@ -117965,6 +124417,16 @@ func UnmarshalSecurityGroupRuleLocalPatchCIDR(m map[string]json.RawMessage, resu return } +// asPatch returns a generic map representation of the SecurityGroupRuleLocalPatchCIDR +func (securityGroupRuleLocalPatchCIDR *SecurityGroupRuleLocalPatchCIDR) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleLocalPatchCIDR.CIDRBlock) { + _patch["cidr_block"] = securityGroupRuleLocalPatchCIDR.CIDRBlock + } + + return +} + // SecurityGroupRuleLocalPatchIP : SecurityGroupRuleLocalPatchIP struct // This model "extends" SecurityGroupRuleLocalPatch type SecurityGroupRuleLocalPatchIP struct { @@ -118003,6 +124465,16 @@ func UnmarshalSecurityGroupRuleLocalPatchIP(m map[string]json.RawMessage, result return } +// asPatch returns a generic map representation of the SecurityGroupRuleLocalPatchIP +func (securityGroupRuleLocalPatchIP *SecurityGroupRuleLocalPatchIP) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleLocalPatchIP.Address) { + _patch["address"] = securityGroupRuleLocalPatchIP.Address + } + + return +} + // SecurityGroupRuleLocalPrototypeCIDR : SecurityGroupRuleLocalPrototypeCIDR struct // This model "extends" SecurityGroupRuleLocalPrototype type SecurityGroupRuleLocalPrototypeCIDR struct { @@ -118527,6 +124999,16 @@ func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, res return } +// asPatch returns a generic map representation of the SecurityGroupRuleRemotePatchCIDR +func (securityGroupRuleRemotePatchCIDR *SecurityGroupRuleRemotePatchCIDR) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleRemotePatchCIDR.CIDRBlock) { + _patch["cidr_block"] = securityGroupRuleRemotePatchCIDR.CIDRBlock + } + + return +} + // SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct // This model "extends" SecurityGroupRuleRemotePatch type SecurityGroupRuleRemotePatchIP struct { @@ -118565,6 +125047,16 @@ func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, resul return } +// asPatch returns a generic map representation of the SecurityGroupRuleRemotePatchIP +func (securityGroupRuleRemotePatchIP *SecurityGroupRuleRemotePatchIP) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleRemotePatchIP.Address) { + _patch["address"] = securityGroupRuleRemotePatchIP.Address + } + + return +} + // SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. // Models which "extend" this model: // - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID @@ -118617,6 +125109,22 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]jso return } +// asPatch returns a generic map representation of the SecurityGroupRuleRemotePatchSecurityGroupIdentity +func (securityGroupRuleRemotePatchSecurityGroupIdentity *SecurityGroupRuleRemotePatchSecurityGroupIdentity) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleRemotePatchSecurityGroupIdentity.ID) { + _patch["id"] = securityGroupRuleRemotePatchSecurityGroupIdentity.ID + } + if !core.IsNil(securityGroupRuleRemotePatchSecurityGroupIdentity.CRN) { + _patch["crn"] = securityGroupRuleRemotePatchSecurityGroupIdentity.CRN + } + if !core.IsNil(securityGroupRuleRemotePatchSecurityGroupIdentity.Href) { + _patch["href"] = securityGroupRuleRemotePatchSecurityGroupIdentity.Href + } + + return +} + // SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct // This model "extends" SecurityGroupRuleRemotePrototype type SecurityGroupRuleRemotePrototypeCIDR struct { @@ -120131,9 +126639,8 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // packets that are invalid based on the current connection state and protocol. See [Protocol state filtering // mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information. const ( - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeAutoConst = "auto" - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeDisabledConst = "disabled" - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeEnabledConst = "enabled" + ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeAutoConst = "auto" + ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeEnabledConst = "enabled" ) func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { @@ -120253,9 +126760,6 @@ func UnmarshalShareProfileCapacityDependentRange(m map[string]json.RawMessage, r // ShareProfileCapacityEnum : The permitted total capacities (in gigabytes) of a share with this profile. // This model "extends" ShareProfileCapacity type ShareProfileCapacityEnum struct { - // The default value for this profile field. - Default interface{} `json:"default" validate:"required"` - // The type for this profile field. Type *string `json:"type" validate:"required"` @@ -120276,11 +126780,6 @@ func (*ShareProfileCapacityEnum) isaShareProfileCapacity() bool { // UnmarshalShareProfileCapacityEnum unmarshals an instance of ShareProfileCapacityEnum from the specified map of raw messages. func UnmarshalShareProfileCapacityEnum(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareProfileCapacityEnum) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) @@ -120624,6 +127123,16 @@ func UnmarshalShareProfileIdentityByHref(m map[string]json.RawMessage, result in return } +// asPatch returns a generic map representation of the ShareProfileIdentityByHref +func (shareProfileIdentityByHref *ShareProfileIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(shareProfileIdentityByHref.Href) { + _patch["href"] = shareProfileIdentityByHref.Href + } + + return +} + // ShareProfileIdentityByName : ShareProfileIdentityByName struct // This model "extends" ShareProfileIdentity type ShareProfileIdentityByName struct { @@ -120659,6 +127168,16 @@ func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result in return } +// asPatch returns a generic map representation of the ShareProfileIdentityByName +func (shareProfileIdentityByName *ShareProfileIdentityByName) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(shareProfileIdentityByName.Name) { + _patch["name"] = shareProfileIdentityByName.Name + } + + return +} + // SharePrototypeShareByOriginShare : Create an accessor file share for an existing file share. The values for `initial_owner`, // `access_control_mode`, `encryption_key`, `zone`, `profile`, `iops` and `size` will be inherited from `origin_share`. // This model "extends" SharePrototype @@ -120975,7 +127494,7 @@ type SharePrototypeShareBySourceShare struct { // The cron specification for the file share replication schedule. // - // Replication of a share can be scheduled to occur at most once per hour. + // Replication of a share can be scheduled to occur at most once every 15 minutes. // // The scheduling frequency for this property may // [increase](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -121447,6 +127966,16 @@ func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface return } +// asPatch returns a generic map representation of the SubnetIdentityByCRN +func (subnetIdentityByCRN *SubnetIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetIdentityByCRN.CRN) { + _patch["crn"] = subnetIdentityByCRN.CRN + } + + return +} + // SubnetIdentityByHref : SubnetIdentityByHref struct // This model "extends" SubnetIdentity type SubnetIdentityByHref struct { @@ -121482,6 +128011,16 @@ func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interfac return } +// asPatch returns a generic map representation of the SubnetIdentityByHref +func (subnetIdentityByHref *SubnetIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetIdentityByHref.Href) { + _patch["href"] = subnetIdentityByHref.Href + } + + return +} + // SubnetIdentityByID : SubnetIdentityByID struct // This model "extends" SubnetIdentity type SubnetIdentityByID struct { @@ -121517,6 +128056,16 @@ func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{ return } +// asPatch returns a generic map representation of the SubnetIdentityByID +func (subnetIdentityByID *SubnetIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetIdentityByID.ID) { + _patch["id"] = subnetIdentityByID.ID + } + + return +} + // SubnetPrototypeSubnetByCIDR : SubnetPrototypeSubnetByCIDR struct // This model "extends" SubnetPrototype type SubnetPrototypeSubnetByCIDR struct { @@ -121778,6 +128327,16 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(m map[string]js return } +// asPatch returns a generic map representation of the SubnetPublicGatewayPatchPublicGatewayIdentityByCRN +func (subnetPublicGatewayPatchPublicGatewayIdentityByCRN *SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetPublicGatewayPatchPublicGatewayIdentityByCRN.CRN) { + _patch["crn"] = subnetPublicGatewayPatchPublicGatewayIdentityByCRN.CRN + } + + return +} + // SubnetPublicGatewayPatchPublicGatewayIdentityByHref : SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct // This model "extends" SubnetPublicGatewayPatch type SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct { @@ -121813,6 +128372,16 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref(m map[string]j return } +// asPatch returns a generic map representation of the SubnetPublicGatewayPatchPublicGatewayIdentityByHref +func (subnetPublicGatewayPatchPublicGatewayIdentityByHref *SubnetPublicGatewayPatchPublicGatewayIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetPublicGatewayPatchPublicGatewayIdentityByHref.Href) { + _patch["href"] = subnetPublicGatewayPatchPublicGatewayIdentityByHref.Href + } + + return +} + // SubnetPublicGatewayPatchPublicGatewayIdentityByID : SubnetPublicGatewayPatchPublicGatewayIdentityByID struct // This model "extends" SubnetPublicGatewayPatch type SubnetPublicGatewayPatchPublicGatewayIdentityByID struct { @@ -121848,16 +128417,26 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID(m map[string]jso return } -// TrustedProfileIdentityTrustedProfileByCRN : TrustedProfileIdentityTrustedProfileByCRN struct +// asPatch returns a generic map representation of the SubnetPublicGatewayPatchPublicGatewayIdentityByID +func (subnetPublicGatewayPatchPublicGatewayIdentityByID *SubnetPublicGatewayPatchPublicGatewayIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(subnetPublicGatewayPatchPublicGatewayIdentityByID.ID) { + _patch["id"] = subnetPublicGatewayPatchPublicGatewayIdentityByID.ID + } + + return +} + +// TrustedProfileIdentityByCRN : TrustedProfileIdentityByCRN struct // This model "extends" TrustedProfileIdentity -type TrustedProfileIdentityTrustedProfileByCRN struct { +type TrustedProfileIdentityByCRN struct { // The CRN for this trusted profile. CRN *string `json:"crn" validate:"required"` } -// NewTrustedProfileIdentityTrustedProfileByCRN : Instantiate TrustedProfileIdentityTrustedProfileByCRN (Generic Model Constructor) -func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByCRN(crn string) (_model *TrustedProfileIdentityTrustedProfileByCRN, err error) { - _model = &TrustedProfileIdentityTrustedProfileByCRN{ +// NewTrustedProfileIdentityByCRN : Instantiate TrustedProfileIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewTrustedProfileIdentityByCRN(crn string) (_model *TrustedProfileIdentityByCRN, err error) { + _model = &TrustedProfileIdentityByCRN{ CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") @@ -121867,13 +128446,13 @@ func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByCRN(crn string) (_model * return } -func (*TrustedProfileIdentityTrustedProfileByCRN) isaTrustedProfileIdentity() bool { +func (*TrustedProfileIdentityByCRN) isaTrustedProfileIdentity() bool { return true } -// UnmarshalTrustedProfileIdentityTrustedProfileByCRN unmarshals an instance of TrustedProfileIdentityTrustedProfileByCRN from the specified map of raw messages. -func UnmarshalTrustedProfileIdentityTrustedProfileByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TrustedProfileIdentityTrustedProfileByCRN) +// UnmarshalTrustedProfileIdentityByCRN unmarshals an instance of TrustedProfileIdentityByCRN from the specified map of raw messages. +func UnmarshalTrustedProfileIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileIdentityByCRN) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) @@ -121883,16 +128462,16 @@ func UnmarshalTrustedProfileIdentityTrustedProfileByCRN(m map[string]json.RawMes return } -// TrustedProfileIdentityTrustedProfileByID : TrustedProfileIdentityTrustedProfileByID struct +// TrustedProfileIdentityByID : TrustedProfileIdentityByID struct // This model "extends" TrustedProfileIdentity -type TrustedProfileIdentityTrustedProfileByID struct { +type TrustedProfileIdentityByID struct { // The unique identifier for this trusted profile. ID *string `json:"id" validate:"required"` } -// NewTrustedProfileIdentityTrustedProfileByID : Instantiate TrustedProfileIdentityTrustedProfileByID (Generic Model Constructor) -func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByID(id string) (_model *TrustedProfileIdentityTrustedProfileByID, err error) { - _model = &TrustedProfileIdentityTrustedProfileByID{ +// NewTrustedProfileIdentityByID : Instantiate TrustedProfileIdentityByID (Generic Model Constructor) +func (*VpcV1) NewTrustedProfileIdentityByID(id string) (_model *TrustedProfileIdentityByID, err error) { + _model = &TrustedProfileIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") @@ -121902,13 +128481,13 @@ func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByID(id string) (_model *Tr return } -func (*TrustedProfileIdentityTrustedProfileByID) isaTrustedProfileIdentity() bool { +func (*TrustedProfileIdentityByID) isaTrustedProfileIdentity() bool { return true } -// UnmarshalTrustedProfileIdentityTrustedProfileByID unmarshals an instance of TrustedProfileIdentityTrustedProfileByID from the specified map of raw messages. -func UnmarshalTrustedProfileIdentityTrustedProfileByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TrustedProfileIdentityTrustedProfileByID) +// UnmarshalTrustedProfileIdentityByID unmarshals an instance of TrustedProfileIdentityByID from the specified map of raw messages. +func UnmarshalTrustedProfileIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) @@ -122255,6 +128834,16 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN(m map[string]json.RawMessag return } +// asPatch returns a generic map representation of the VpcdnsResolverVPCPatchVPCIdentityByCRN +func (vpcdnsResolverVPCPatchVPCIdentityByCRN *VpcdnsResolverVPCPatchVPCIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcdnsResolverVPCPatchVPCIdentityByCRN.CRN) { + _patch["crn"] = vpcdnsResolverVPCPatchVPCIdentityByCRN.CRN + } + + return +} + // VpcdnsResolverVPCPatchVPCIdentityByHref : VpcdnsResolverVPCPatchVPCIdentityByHref struct // This model "extends" VpcdnsResolverVPCPatch type VpcdnsResolverVPCPatchVPCIdentityByHref struct { @@ -122290,6 +128879,16 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref(m map[string]json.RawMessa return } +// asPatch returns a generic map representation of the VpcdnsResolverVPCPatchVPCIdentityByHref +func (vpcdnsResolverVPCPatchVPCIdentityByHref *VpcdnsResolverVPCPatchVPCIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcdnsResolverVPCPatchVPCIdentityByHref.Href) { + _patch["href"] = vpcdnsResolverVPCPatchVPCIdentityByHref.Href + } + + return +} + // VpcdnsResolverVPCPatchVPCIdentityByID : VpcdnsResolverVPCPatchVPCIdentityByID struct // This model "extends" VpcdnsResolverVPCPatch type VpcdnsResolverVPCPatchVPCIdentityByID struct { @@ -122325,6 +128924,16 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID(m map[string]json.RawMessage return } +// asPatch returns a generic map representation of the VpcdnsResolverVPCPatchVPCIdentityByID +func (vpcdnsResolverVPCPatchVPCIdentityByID *VpcdnsResolverVPCPatchVPCIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpcdnsResolverVPCPatchVPCIdentityByID.ID) { + _patch["id"] = vpcdnsResolverVPCPatchVPCIdentityByID.ID + } + + return +} + // VPCIdentityByCRN : VPCIdentityByCRN struct // This model "extends" VPCIdentity type VPCIdentityByCRN struct { @@ -122861,6 +129470,16 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(m map[st return } +// asPatch returns a generic map representation of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref +func (vpnGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref.Href) { + _patch["href"] = vpnGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref.Href + } + + return +} + // VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct // This model "extends" VPNGatewayConnectionIkePolicyPatch type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct { @@ -122896,6 +129515,16 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[stri return } +// asPatch returns a generic map representation of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID +func (vpnGatewayConnectionIkePolicyPatchIkePolicyIdentityByID *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionIkePolicyPatchIkePolicyIdentityByID.ID) { + _patch["id"] = vpnGatewayConnectionIkePolicyPatchIkePolicyIdentityByID.ID + } + + return +} + // VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct // This model "extends" VPNGatewayConnectionIkePolicyPrototype type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct { @@ -123001,6 +129630,16 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(m ma return } +// asPatch returns a generic map representation of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref +func (vpnGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref.Href) { + _patch["href"] = vpnGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref.Href + } + + return +} + // VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct // This model "extends" VPNGatewayConnectionIPsecPolicyPatch type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct { @@ -123036,6 +129675,16 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[ return } +// asPatch returns a generic map representation of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID +func (vpnGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID.ID) { + _patch["id"] = vpnGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID.ID + } + + return +} + // VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct // This model "extends" VPNGatewayConnectionIPsecPolicyPrototype type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct { @@ -123150,6 +129799,19 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPat return } +// asPatch returns a generic map representation of the VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch +func (vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch *VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch.Address) { + _patch["address"] = vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch.Address + } + if !core.IsNil(vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch.Fqdn) { + _patch["fqdn"] = vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch.Fqdn + } + + return +} + // VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch : The peer VPN gateway for this connection. If `peer.type` is `ipv4_address`, only `peer.address` may be specified. If // `peer.type` is fqdn, only `peer.fqdn` may be specified. // Models which "extend" this model: @@ -123194,6 +129856,19 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe return } +// asPatch returns a generic map representation of the VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch +func (vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch *VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch.Address) { + _patch["address"] = vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch.Address + } + if !core.IsNil(vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch.Fqdn) { + _patch["fqdn"] = vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch.Fqdn + } + + return +} + // VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct // This model "extends" VPNGatewayConnection type VPNGatewayConnectionPolicyMode struct { @@ -124880,6 +131555,16 @@ func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json return } +// asPatch returns a generic map representation of the VPNServerAuthenticationByUsernameIDProviderByIam +func (vpnServerAuthenticationByUsernameIDProviderByIam *VPNServerAuthenticationByUsernameIDProviderByIam) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnServerAuthenticationByUsernameIDProviderByIam.ProviderType) { + _patch["provider_type"] = vpnServerAuthenticationByUsernameIDProviderByIam.ProviderType + } + + return +} + // VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct // This model "extends" VPNServerAuthenticationPrototype type VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct { @@ -124939,6 +131624,22 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertifica return } +// asPatch returns a generic map representation of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype +func (vpnServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype *VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Method) { + _patch["method"] = vpnServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Method + } + if !core.IsNil(vpnServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.ClientCa) { + _patch["client_ca"] = vpnServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.ClientCa.asPatch() + } + if !core.IsNil(vpnServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Crl) { + _patch["crl"] = vpnServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Crl + } + + return +} + // VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct // This model "extends" VPNServerAuthenticationPrototype type VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct { @@ -124990,6 +131691,19 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernameP return } +// asPatch returns a generic map representation of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype +func (vpnServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype *VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.Method) { + _patch["method"] = vpnServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.Method + } + if !core.IsNil(vpnServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.IdentityProvider) { + _patch["identity_provider"] = vpnServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.IdentityProvider.asPatch() + } + + return +} + // VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext : Identifies a reserved IP by a unique property. The reserved IP must be currently unbound and in the primary IP's // subnet. // Models which "extend" this model: @@ -126215,6 +132929,16 @@ func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result i return } +// asPatch returns a generic map representation of the VolumeProfileIdentityByHref +func (volumeProfileIdentityByHref *VolumeProfileIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(volumeProfileIdentityByHref.Href) { + _patch["href"] = volumeProfileIdentityByHref.Href + } + + return +} + // VolumeProfileIdentityByName : VolumeProfileIdentityByName struct // This model "extends" VolumeProfileIdentity type VolumeProfileIdentityByName struct { @@ -126250,6 +132974,16 @@ func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result i return } +// asPatch returns a generic map representation of the VolumeProfileIdentityByName +func (volumeProfileIdentityByName *VolumeProfileIdentityByName) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(volumeProfileIdentityByName.Name) { + _patch["name"] = volumeProfileIdentityByName.Name + } + + return +} + // VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct // This model "extends" VolumePrototype type VolumePrototypeVolumeByCapacity struct { @@ -126491,6 +133225,16 @@ func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{ return } +// asPatch returns a generic map representation of the ZoneIdentityByHref +func (zoneIdentityByHref *ZoneIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(zoneIdentityByHref.Href) { + _patch["href"] = zoneIdentityByHref.Href + } + + return +} + // ZoneIdentityByName : ZoneIdentityByName struct // This model "extends" ZoneIdentity type ZoneIdentityByName struct { @@ -126526,6 +133270,16 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ return } +// asPatch returns a generic map representation of the ZoneIdentityByName +func (zoneIdentityByName *ZoneIdentityByName) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(zoneIdentityByName.Name) { + _patch["name"] = zoneIdentityByName.Name + } + + return +} + // BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct // This model "extends" BackupPolicyScopePrototypeEnterpriseIdentity type BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct { @@ -126682,6 +133436,84 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi return } +// ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref : ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref struct +// This model "extends" ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext +type ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref struct { + // The URL for this cluster network subnet reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref : Instantiate ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref (Generic Model Constructor) +func (*VpcV1) NewClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref(href string) (_model *ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref, err error) { + _model = &ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref) isaClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext() bool { + return true +} + +func (*ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref) isaClusterNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref unmarshals an instance of ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref from the specified map of raw messages. +func UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID : ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID struct +// This model "extends" ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext +type ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID struct { + // The unique identifier for this cluster network subnet reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID : Instantiate ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID (Generic Model Constructor) +func (*VpcV1) NewClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID(id string) (_model *ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID, err error) { + _model = &ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID) isaClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext() bool { + return true +} + +func (*ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID) isaClusterNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID unmarshals an instance of ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID from the specified map of raw messages. +func UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity type EndpointGatewayReservedIPReservedIPIdentityByHref struct { @@ -126803,6 +133635,16 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref +func (floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref.Href) { + _patch["href"] = floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref.Href + } + + return +} + // FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct // This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { @@ -126847,6 +133689,16 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID +func (floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID.ID) { + _patch["id"] = floatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID.ID + } + + return +} + // FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { @@ -126890,6 +133742,16 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +func (floatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref.Href) { + _patch["href"] = floatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref.Href + } + + return +} + // FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { @@ -126934,6 +133796,16 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID +func (floatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID.ID) { + _patch["id"] = floatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID.ID + } + + return +} + // FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct // This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { @@ -126973,6 +133845,16 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +func (floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN.CRN) { + _patch["crn"] = floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN.CRN + } + + return +} + // FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { @@ -127012,6 +133894,16 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +func (floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref.Href) { + _patch["href"] = floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref.Href + } + + return +} + // FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct // This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { @@ -127051,6 +133943,16 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork return } +// asPatch returns a generic map representation of the FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +func (floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID.ID) { + _patch["id"] = floatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID.ID + } + + return +} + // FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { @@ -127975,6 +134877,84 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirt return } +// InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref : InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref struct +// This model "extends" InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity +type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref struct { + // The URL for this cluster network interface. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref : Instantiate InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref(href string) (_model *InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref, err error) { + _model = &InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface() bool { + return true +} + +// UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref unmarshals an instance of InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID : InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID struct +// This model "extends" InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity +type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID struct { + // The unique identifier for this cluster network interface. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID : Instantiate InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID(id string) (_model *InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID, err error) { + _model = &InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface() bool { + return true +} + +// UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID unmarshals an instance of InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct // Models which "extend" this model: // - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup @@ -128712,6 +135692,16 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN +func (instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN.CRN) { + _patch["crn"] = instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN.CRN + } + + return +} + // InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct // This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { @@ -128751,6 +135741,16 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref +func (instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref.Href) { + _patch["href"] = instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref.Href + } + + return +} + // InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct // This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { @@ -128790,6 +135790,16 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID +func (instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID.ID) { + _patch["id"] = instancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID.ID + } + + return +} + // InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct // This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { @@ -128829,6 +135839,16 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN +func (instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN.CRN) { + _patch["crn"] = instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN.CRN + } + + return +} + // InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct // This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { @@ -128868,6 +135888,16 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref +func (instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref.Href) { + _patch["href"] = instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref.Href + } + + return +} + // InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct // This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { @@ -128907,6 +135937,16 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden return } +// asPatch returns a generic map representation of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID +func (instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID.ID) { + _patch["id"] = instancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID.ID + } + + return +} + // InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct // This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { @@ -129264,6 +136304,11 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -129389,6 +136434,11 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -129494,6 +136544,11 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -129619,6 +136674,11 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -129724,6 +136784,11 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -129850,6 +136915,11 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAt err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -129955,6 +137025,11 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -130081,6 +137156,11 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkIn err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -130186,6 +137266,11 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -130309,6 +137394,11 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -130409,6 +137499,11 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -130532,6 +137627,11 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -130632,6 +137732,11 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -130755,6 +137860,11 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -130855,6 +137965,11 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -130978,6 +138093,11 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -131078,6 +138198,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -131201,6 +138326,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -131306,6 +138436,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -131429,6 +138564,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -131534,6 +138674,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -131658,6 +138803,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -131763,6 +138913,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -131887,6 +139042,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -131992,6 +139152,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -132113,6 +139278,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -132213,6 +139383,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -132334,6 +139509,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -132434,6 +139614,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -132555,6 +139740,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -132680,6 +139870,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -132801,6 +139996,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -132926,6 +140126,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -133048,6 +140253,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -133173,6 +140383,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -133295,6 +140510,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -133420,6 +140640,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -133542,6 +140767,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -133667,6 +140897,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + // The cluster network attachments to create for this virtual server instance. A cluster network attachment represents + // a device that is connected to a cluster network. The number of network attachments must match one of the values from + // the instance profile's `cluster_network_attachment_count` before the instance can be started. + ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"` + // The confidential compute mode to use for this virtual server instance. // // If unspecified, the default confidential compute mode from the profile will be used. @@ -133792,6 +141027,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext) + if err != nil { + err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode) if err != nil { err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo()) @@ -133955,6 +141195,16 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadB return } +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +func (loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref.Href) { + _patch["href"] = loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref.Href + } + + return +} + // LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { @@ -133994,6 +141244,16 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadB return } +// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +func (loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID.ID) { + _patch["id"] = loadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID.ID + } + + return +} + // LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { @@ -134111,6 +141371,16 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent return } +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN +func (loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN.CRN) { + _patch["crn"] = loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN.CRN + } + + return +} + // LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct // This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { @@ -134150,6 +141420,16 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent return } +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref +func (loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref.Href) { + _patch["href"] = loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref.Href + } + + return +} + // LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct // This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct { @@ -134189,6 +141469,16 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent return } +// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID +func (loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID.ID) { + _patch["id"] = loadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID.ID + } + + return +} + // NetworkInterfaceIPPrototypeReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct // This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity type NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct { @@ -134699,6 +141989,16 @@ func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(m map[stri return } +// asPatch returns a generic map representation of the RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP +func (routeNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP *RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routeNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP.Address) { + _patch["address"] = routeNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP.Address + } + + return +} + // RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct // This model "extends" RouteNextHopPatchRouteNextHopIP type RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct { @@ -134745,6 +142045,16 @@ func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[strin return } +// asPatch returns a generic map representation of the RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP +func (routeNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP *RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routeNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP.Address) { + _patch["address"] = routeNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP.Address + } + + return +} + // RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct // This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { @@ -134784,6 +142094,16 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI return } +// asPatch returns a generic map representation of the RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +func (routeNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routeNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref.Href) { + _patch["href"] = routeNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref.Href + } + + return +} + // RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct // This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { @@ -134823,6 +142143,16 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI return } +// asPatch returns a generic map representation of the RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +func (routeNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(routeNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID.ID) { + _patch["id"] = routeNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID.ID + } + + return +} + // RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct // This model "extends" RouteNextHopPrototypeRouteNextHopIP type RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { @@ -135028,6 +142358,16 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden return } +// asPatch returns a generic map representation of the SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN +func (securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN.CRN) { + _patch["crn"] = securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN.CRN + } + + return +} + // SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct // This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct { @@ -135067,6 +142407,16 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden return } +// asPatch returns a generic map representation of the SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref +func (securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref.Href) { + _patch["href"] = securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref.Href + } + + return +} + // SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct // This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct { @@ -135106,6 +142456,16 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden return } +// asPatch returns a generic map representation of the SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID +func (securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID.ID) { + _patch["id"] = securityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID.ID + } + + return +} + // SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct // This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct { @@ -135367,6 +142727,16 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPat return } +// asPatch returns a generic map representation of the VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch +func (vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch *VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch.Address) { + _patch["address"] = vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch.Address + } + + return +} + // VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct // This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { @@ -135394,6 +142764,16 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPat return } +// asPatch returns a generic map representation of the VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch +func (vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch *VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch.Fqdn) { + _patch["fqdn"] = vpnGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch.Fqdn + } + + return +} + // VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct // This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { @@ -135421,6 +142801,16 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe return } +// asPatch returns a generic map representation of the VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch +func (vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch *VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch.Address) { + _patch["address"] = vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch.Address + } + + return +} + // VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct // This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { @@ -135448,6 +142838,16 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe return } +// asPatch returns a generic map representation of the VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch +func (vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch *VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch.Fqdn) { + _patch["fqdn"] = vpnGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch.Fqdn + } + + return +} + // VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct // This model "extends" VPNGatewayConnectionRouteMode type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { @@ -136708,7 +144108,7 @@ func (pager *VPCRoutesPager) HasNext() bool { } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } @@ -136741,9 +144141,9 @@ func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Rou // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { for pager.HasNext() { - var nextPage []RouteCollectionVPCContextRoutesItem + var nextPage []Route nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136755,14 +144155,14 @@ func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems [] } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutesPager) GetNext() (page []Route, err error) { page, err = pager.GetNextWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutesPager) GetAll() (allItems []Route, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -137504,6 +144904,98 @@ func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { return } +// InstanceClusterNetworkAttachmentsPager can be used to simplify the use of the "ListInstanceClusterNetworkAttachments" method. +type InstanceClusterNetworkAttachmentsPager struct { + hasNext bool + options *ListInstanceClusterNetworkAttachmentsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceClusterNetworkAttachmentsPager returns a new InstanceClusterNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewInstanceClusterNetworkAttachmentsPager(options *ListInstanceClusterNetworkAttachmentsOptions) (pager *InstanceClusterNetworkAttachmentsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) + return + } + + var optionsCopy ListInstanceClusterNetworkAttachmentsOptions = *options + pager = &InstanceClusterNetworkAttachmentsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceClusterNetworkAttachmentsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceClusterNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []InstanceClusterNetworkAttachment, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceClusterNetworkAttachmentsWithContext(ctx, pager.options) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + errMsg := fmt.Sprintf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + err = core.SDKErrorf(err, errMsg, "get-query-error", common.GetComponentInfo()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.ClusterNetworkAttachments + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceClusterNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceClusterNetworkAttachment, err error) { + for pager.HasNext() { + var nextPage []InstanceClusterNetworkAttachment + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceClusterNetworkAttachmentsPager) GetNext() (page []InstanceClusterNetworkAttachment, err error) { + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceClusterNetworkAttachmentsPager) GetAll() (allItems []InstanceClusterNetworkAttachment, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + // InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. type InstanceNetworkInterfaceIpsPager struct { hasNext bool @@ -140080,6 +147572,466 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPRef return } +// ClusterNetworkProfilesPager can be used to simplify the use of the "ListClusterNetworkProfiles" method. +type ClusterNetworkProfilesPager struct { + hasNext bool + options *ListClusterNetworkProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewClusterNetworkProfilesPager returns a new ClusterNetworkProfilesPager instance. +func (vpc *VpcV1) NewClusterNetworkProfilesPager(options *ListClusterNetworkProfilesOptions) (pager *ClusterNetworkProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) + return + } + + var optionsCopy ListClusterNetworkProfilesOptions = *options + pager = &ClusterNetworkProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ClusterNetworkProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ClusterNetworkProfilesPager) GetNextWithContext(ctx context.Context) (page []ClusterNetworkProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListClusterNetworkProfilesWithContext(ctx, pager.options) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + errMsg := fmt.Sprintf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + err = core.SDKErrorf(err, errMsg, "get-query-error", common.GetComponentInfo()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Profiles + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ClusterNetworkProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ClusterNetworkProfile, err error) { + for pager.HasNext() { + var nextPage []ClusterNetworkProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworkProfilesPager) GetNext() (page []ClusterNetworkProfile, err error) { + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworkProfilesPager) GetAll() (allItems []ClusterNetworkProfile, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ClusterNetworksPager can be used to simplify the use of the "ListClusterNetworks" method. +type ClusterNetworksPager struct { + hasNext bool + options *ListClusterNetworksOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewClusterNetworksPager returns a new ClusterNetworksPager instance. +func (vpc *VpcV1) NewClusterNetworksPager(options *ListClusterNetworksOptions) (pager *ClusterNetworksPager, err error) { + if options.Start != nil && *options.Start != "" { + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) + return + } + + var optionsCopy ListClusterNetworksOptions = *options + pager = &ClusterNetworksPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ClusterNetworksPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ClusterNetworksPager) GetNextWithContext(ctx context.Context) (page []ClusterNetwork, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListClusterNetworksWithContext(ctx, pager.options) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + errMsg := fmt.Sprintf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + err = core.SDKErrorf(err, errMsg, "get-query-error", common.GetComponentInfo()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.ClusterNetworks + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ClusterNetworksPager) GetAllWithContext(ctx context.Context) (allItems []ClusterNetwork, err error) { + for pager.HasNext() { + var nextPage []ClusterNetwork + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworksPager) GetNext() (page []ClusterNetwork, err error) { + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworksPager) GetAll() (allItems []ClusterNetwork, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ClusterNetworkInterfacesPager can be used to simplify the use of the "ListClusterNetworkInterfaces" method. +type ClusterNetworkInterfacesPager struct { + hasNext bool + options *ListClusterNetworkInterfacesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewClusterNetworkInterfacesPager returns a new ClusterNetworkInterfacesPager instance. +func (vpc *VpcV1) NewClusterNetworkInterfacesPager(options *ListClusterNetworkInterfacesOptions) (pager *ClusterNetworkInterfacesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) + return + } + + var optionsCopy ListClusterNetworkInterfacesOptions = *options + pager = &ClusterNetworkInterfacesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ClusterNetworkInterfacesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ClusterNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []ClusterNetworkInterface, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListClusterNetworkInterfacesWithContext(ctx, pager.options) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + errMsg := fmt.Sprintf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + err = core.SDKErrorf(err, errMsg, "get-query-error", common.GetComponentInfo()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Interfaces + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ClusterNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []ClusterNetworkInterface, err error) { + for pager.HasNext() { + var nextPage []ClusterNetworkInterface + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworkInterfacesPager) GetNext() (page []ClusterNetworkInterface, err error) { + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworkInterfacesPager) GetAll() (allItems []ClusterNetworkInterface, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ClusterNetworkSubnetsPager can be used to simplify the use of the "ListClusterNetworkSubnets" method. +type ClusterNetworkSubnetsPager struct { + hasNext bool + options *ListClusterNetworkSubnetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewClusterNetworkSubnetsPager returns a new ClusterNetworkSubnetsPager instance. +func (vpc *VpcV1) NewClusterNetworkSubnetsPager(options *ListClusterNetworkSubnetsOptions) (pager *ClusterNetworkSubnetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) + return + } + + var optionsCopy ListClusterNetworkSubnetsOptions = *options + pager = &ClusterNetworkSubnetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ClusterNetworkSubnetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ClusterNetworkSubnetsPager) GetNextWithContext(ctx context.Context) (page []ClusterNetworkSubnet, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListClusterNetworkSubnetsWithContext(ctx, pager.options) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + errMsg := fmt.Sprintf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + err = core.SDKErrorf(err, errMsg, "get-query-error", common.GetComponentInfo()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Subnets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ClusterNetworkSubnetsPager) GetAllWithContext(ctx context.Context) (allItems []ClusterNetworkSubnet, err error) { + for pager.HasNext() { + var nextPage []ClusterNetworkSubnet + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworkSubnetsPager) GetNext() (page []ClusterNetworkSubnet, err error) { + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworkSubnetsPager) GetAll() (allItems []ClusterNetworkSubnet, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ClusterNetworkSubnetReservedIpsPager can be used to simplify the use of the "ListClusterNetworkSubnetReservedIps" method. +type ClusterNetworkSubnetReservedIpsPager struct { + hasNext bool + options *ListClusterNetworkSubnetReservedIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewClusterNetworkSubnetReservedIpsPager returns a new ClusterNetworkSubnetReservedIpsPager instance. +func (vpc *VpcV1) NewClusterNetworkSubnetReservedIpsPager(options *ListClusterNetworkSubnetReservedIpsOptions) (pager *ClusterNetworkSubnetReservedIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) + return + } + + var optionsCopy ListClusterNetworkSubnetReservedIpsOptions = *options + pager = &ClusterNetworkSubnetReservedIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ClusterNetworkSubnetReservedIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ClusterNetworkSubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ClusterNetworkSubnetReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListClusterNetworkSubnetReservedIpsWithContext(ctx, pager.options) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + errMsg := fmt.Sprintf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + err = core.SDKErrorf(err, errMsg, "get-query-error", common.GetComponentInfo()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.ReservedIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ClusterNetworkSubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ClusterNetworkSubnetReservedIP, err error) { + for pager.HasNext() { + var nextPage []ClusterNetworkSubnetReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworkSubnetReservedIpsPager) GetNext() (page []ClusterNetworkSubnetReservedIP, err error) { + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ClusterNetworkSubnetReservedIpsPager) GetAll() (allItems []ClusterNetworkSubnetReservedIP, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + // PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. type PublicGatewaysPager struct { hasNext bool diff --git a/vpcv1/vpc_v1_examples_test.go b/vpcv1/vpc_v1_examples_test.go index a5ef2bb..f4e212b 100644 --- a/vpcv1/vpc_v1_examples_test.go +++ b/vpcv1/vpc_v1_examples_test.go @@ -19,7 +19,6 @@ package vpcv1_test import ( - "encoding/json" "fmt" "os" "reflect" @@ -33,27 +32,35 @@ import ( ) var ( - vpcService *vpcv1.VpcV1 - serviceErr error - configLoaded bool = false - externalConfigFile = "../vpc.env" - backupPolicyID string - backupPolicyPlanID string - backupPolicyPlanRemoteCopyID string - backupPolicyJobID string - vpcID string - vpcdnsResolutionBindingID string - subnetID string - keyID string - imageID string - imageExportJobID string - instanceID string - addressPrefixID string - routingTableID string - routeID string - eth2ID string - floatingIPID string - volumeID string + vpcService *vpcv1.VpcV1 + serviceErr error + configLoaded bool = false + externalConfigFile = "../vpc.env" + backupPolicyID string + backupPolicyPlanID string + backupPolicyPlanRemoteCopyID string + backupPolicyJobID string + vpcID string + vpcdnsResolutionBindingID string + subnetID string + keyID string + imageID string + imageExportJobID string + instanceID string + addressPrefixID string + routingTableID string + routeID string + eth2ID string + floatingIPID string + volumeID string + + clusterNetworkID string + clusterNetworkSubnetID string + clusterNetworkSubnetReservedIpID string + clusterNetworkInterfaceID string + clusterNetworkProfileName string + instanceClusterNetworkAttachmentID string + snapshotID string snapshotConsistencyGroupID string snapshotCopyCRN string @@ -1945,6 +1952,100 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { Expect(action).ToNot(BeNil()) }) + + It(`ListInstanceClusterNetworkAttachments request example`, func() { + fmt.Println("\nListInstanceClusterNetworkAttachments() result:") + // begin-list_instance_cluster_network_attachments + listInstanceClusterNetworkAttachmentsOptions := &vpcv1.ListInstanceClusterNetworkAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceClusterNetworkAttachmentsPager(listInstanceClusterNetworkAttachmentsOptions) + if err != nil { + panic(err) + } + + var allResults []vpcv1.InstanceClusterNetworkAttachment + for pager.HasNext() { + nextPage, err := pager.GetNext() + if err != nil { + panic(err) + } + allResults = append(allResults, nextPage...) + } + // end-list_instance_cluster_network_attachments + }) + It(`CreateClusterNetworkAttachment request example`, func() { + fmt.Println("\nCreateClusterNetworkAttachment() result:") + // begin-create_cluster_network_attachment + + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := &vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment{} + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-instance-cluster-network-attachment") + createClusterNetworkAttachmentOptions := vpcService.NewCreateClusterNetworkAttachmentOptions( + instanceID, + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel, + ) + + instanceClusterNetworkAttachment, response, err := vpcService.CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptions) + if err != nil { + panic(err) + } + + // end-create_cluster_network_attachment + instanceClusterNetworkAttachmentID = *instanceClusterNetworkAttachment.ID + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(instanceClusterNetworkAttachment).ToNot(BeNil()) + }) + It(`GetInstanceClusterNetworkAttachment request example`, func() { + fmt.Println("\nGetInstanceClusterNetworkAttachment() result:") + // begin-get_instance_cluster_network_attachment + + getInstanceClusterNetworkAttachmentOptions := vpcService.NewGetInstanceClusterNetworkAttachmentOptions( + instanceID, + instanceClusterNetworkAttachmentID, + ) + + instanceClusterNetworkAttachment, response, err := vpcService.GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptions) + if err != nil { + panic(err) + } + + // end-get_instance_cluster_network_attachment + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(instanceClusterNetworkAttachment).ToNot(BeNil()) + }) + It(`UpdateInstanceClusterNetworkAttachment request example`, func() { + fmt.Println("\nUpdateInstanceClusterNetworkAttachment() result:") + // begin-update_instance_cluster_network_attachment + + instanceClusterNetworkAttachmentPatchModel := &vpcv1.InstanceClusterNetworkAttachmentPatch{ + Name: core.StringPtr("my-instance-cluster-network-attachment-updated"), + } + instanceClusterNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceClusterNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateInstanceClusterNetworkAttachmentOptions := vpcService.NewUpdateInstanceClusterNetworkAttachmentOptions( + instanceID, + instanceClusterNetworkAttachmentID, + instanceClusterNetworkAttachmentPatchModelAsPatch, + ) + + instanceClusterNetworkAttachment, response, err := vpcService.UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptions) + if err != nil { + panic(err) + } + + // end-update_instance_cluster_network_attachment + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(instanceClusterNetworkAttachment).ToNot(BeNil()) + }) + It(`CreateInstanceConsoleAccessToken request example`, func() { Skip("not runnin with mock") fmt.Println("\nCreateInstanceConsoleAccessToken() result:") @@ -2820,8 +2921,7 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { } allResults = append(allResults, nextPage...) } - b, _ := json.MarshalIndent(allResults, "", " ") - fmt.Println(string(b)) + // end-list_reservations }) It(`CreateReservation request example`, func() { @@ -3631,6 +3731,427 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { Expect(zone).ToNot(BeNil()) }) + + It(`ListClusterNetworkProfiles request example`, func() { + fmt.Println("\nListClusterNetworkProfiles() result:") + // begin-list_cluster_network_profiles + listClusterNetworkProfilesOptions := &vpcv1.ListClusterNetworkProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewClusterNetworkProfilesPager(listClusterNetworkProfilesOptions) + if err != nil { + panic(err) + } + + var allResults []vpcv1.ClusterNetworkProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + if err != nil { + panic(err) + } + allResults = append(allResults, nextPage...) + } + // end-list_cluster_network_profiles + clusterNetworkProfileName = *allResults[0].Name + }) + It(`GetClusterNetworkProfile request example`, func() { + fmt.Println("\nGetClusterNetworkProfile() result:") + // begin-get_cluster_network_profile + + getClusterNetworkProfileOptions := vpcService.NewGetClusterNetworkProfileOptions( + clusterNetworkProfileName, + ) + + clusterNetworkProfile, response, err := vpcService.GetClusterNetworkProfile(getClusterNetworkProfileOptions) + if err != nil { + panic(err) + } + // end-get_cluster_network_profile + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetworkProfile).ToNot(BeNil()) + }) + It(`ListClusterNetworks request example`, func() { + fmt.Println("\nListClusterNetworks() result:") + // begin-list_cluster_networks + listClusterNetworksOptions := &vpcv1.ListClusterNetworksOptions{ + Limit: core.Int64Ptr(int64(10)), + VPCID: core.StringPtr(vpcID), + } + + pager, err := vpcService.NewClusterNetworksPager(listClusterNetworksOptions) + if err != nil { + panic(err) + } + + var allResults []vpcv1.ClusterNetwork + for pager.HasNext() { + nextPage, err := pager.GetNext() + if err != nil { + panic(err) + } + allResults = append(allResults, nextPage...) + } + // end-list_cluster_networks + }) + It(`CreateClusterNetwork request example`, func() { + fmt.Println("\nCreateClusterNetwork() result:") + // begin-create_cluster_network + + clusterNetworkProfileIdentityModel := &vpcv1.ClusterNetworkProfileIdentityByName{ + Name: core.StringPtr(clusterNetworkProfileName), + } + + vpcIdentityModel := &vpcv1.VPCIdentityByID{ + ID: core.StringPtr(vpcID), + } + + zoneIdentityModel := &vpcv1.ZoneIdentityByName{ + Name: zone, + } + + createClusterNetworkOptions := vpcService.NewCreateClusterNetworkOptions( + clusterNetworkProfileIdentityModel, + vpcIdentityModel, + zoneIdentityModel, + ) + createClusterNetworkOptions.Name = core.StringPtr("my-cluster-network") + clusterNetwork, response, err := vpcService.CreateClusterNetwork(createClusterNetworkOptions) + if err != nil { + panic(err) + } + + // end-create_cluster_network + clusterNetworkID = *clusterNetwork.ID + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(clusterNetwork).ToNot(BeNil()) + }) + It(`ListClusterNetworkInterfaces request example`, func() { + fmt.Println("\nListClusterNetworkInterfaces() result:") + // begin-list_cluster_network_interfaces + listClusterNetworkInterfacesOptions := &vpcv1.ListClusterNetworkInterfacesOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewClusterNetworkInterfacesPager(listClusterNetworkInterfacesOptions) + if err != nil { + panic(err) + } + + var allResults []vpcv1.ClusterNetworkInterface + for pager.HasNext() { + nextPage, err := pager.GetNext() + if err != nil { + panic(err) + } + allResults = append(allResults, nextPage...) + } + // end-list_cluster_network_interfaces + }) + It(`CreateClusterNetworkInterface request example`, func() { + fmt.Println("\nCreateClusterNetworkInterface() result:") + // begin-create_cluster_network_interface + + createClusterNetworkInterfaceOptions := vpcService.NewCreateClusterNetworkInterfaceOptions( + clusterNetworkID, + ) + createClusterNetworkInterfaceOptions.Name = core.StringPtr("my-cluster-network-interface") + clusterNetworkInterface, response, err := vpcService.CreateClusterNetworkInterface(createClusterNetworkInterfaceOptions) + if err != nil { + panic(err) + } + + // end-create_cluster_network_interface + clusterNetworkInterfaceID = *clusterNetworkInterface.ID + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(clusterNetworkInterface).ToNot(BeNil()) + }) + It(`GetClusterNetworkInterface request example`, func() { + fmt.Println("\nGetClusterNetworkInterface() result:") + // begin-get_cluster_network_interface + + getClusterNetworkInterfaceOptions := vpcService.NewGetClusterNetworkInterfaceOptions( + clusterNetworkID, + clusterNetworkInterfaceID, + ) + + clusterNetworkInterface, response, err := vpcService.GetClusterNetworkInterface(getClusterNetworkInterfaceOptions) + if err != nil { + panic(err) + } + + // end-get_cluster_network_interface + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetworkInterface).ToNot(BeNil()) + }) + It(`UpdateClusterNetworkInterface request example`, func() { + fmt.Println("\nUpdateClusterNetworkInterface() result:") + // begin-update_cluster_network_interface + + clusterNetworkInterfacePatchModel := &vpcv1.ClusterNetworkInterfacePatch{} + clusterNetworkInterfacePatchModel.Name = core.StringPtr("my-cluster-network-interface-updated") + clusterNetworkInterfacePatchModelAsPatch, asPatchErr := clusterNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateClusterNetworkInterfaceOptions := vpcService.NewUpdateClusterNetworkInterfaceOptions( + clusterNetworkID, + clusterNetworkInterfaceID, + clusterNetworkInterfacePatchModelAsPatch, + ) + updateClusterNetworkInterfaceOptions.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + + clusterNetworkInterface, response, err := vpcService.UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptions) + if err != nil { + panic(err) + } + + // end-update_cluster_network_interface + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetworkInterface).ToNot(BeNil()) + }) + It(`ListClusterNetworkSubnets request example`, func() { + fmt.Println("\nListClusterNetworkSubnets() result:") + // begin-list_cluster_network_subnets + listClusterNetworkSubnetsOptions := &vpcv1.ListClusterNetworkSubnetsOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewClusterNetworkSubnetsPager(listClusterNetworkSubnetsOptions) + if err != nil { + panic(err) + } + + var allResults []vpcv1.ClusterNetworkSubnet + for pager.HasNext() { + nextPage, err := pager.GetNext() + if err != nil { + panic(err) + } + allResults = append(allResults, nextPage...) + } + // end-list_cluster_network_subnets + }) + It(`CreateClusterNetworkSubnet request example`, func() { + fmt.Println("\nCreateClusterNetworkSubnet() result:") + // begin-create_cluster_network_subnet + + clusterNetworkSubnetPrototypeModel := &vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype{ + TotalIpv4AddressCount: core.Int64Ptr(int64(256)), + } + clusterNetworkSubnetPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet") + + createClusterNetworkSubnetOptions := vpcService.NewCreateClusterNetworkSubnetOptions( + clusterNetworkID, + clusterNetworkSubnetPrototypeModel, + ) + + clusterNetworkSubnet, response, err := vpcService.CreateClusterNetworkSubnet(createClusterNetworkSubnetOptions) + if err != nil { + panic(err) + } + + // end-create_cluster_network_subnet + clusterNetworkSubnetID = *clusterNetworkSubnet.ID + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(clusterNetworkSubnet).ToNot(BeNil()) + }) + It(`ListClusterNetworkSubnetReservedIps request example`, func() { + fmt.Println("\nListClusterNetworkSubnetReservedIps() result:") + // begin-list_cluster_network_subnet_reserved_ips + listClusterNetworkSubnetReservedIpsOptions := &vpcv1.ListClusterNetworkSubnetReservedIpsOptions{ + ClusterNetworkID: core.StringPtr(clusterNetworkID), + ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewClusterNetworkSubnetReservedIpsPager(listClusterNetworkSubnetReservedIpsOptions) + if err != nil { + panic(err) + } + + var allResults []vpcv1.ClusterNetworkSubnetReservedIP + for pager.HasNext() { + nextPage, err := pager.GetNext() + if err != nil { + panic(err) + } + allResults = append(allResults, nextPage...) + } + // end-list_cluster_network_subnet_reserved_ips + }) + It(`CreateClusterNetworkSubnetReservedIP request example`, func() { + fmt.Println("\nCreateClusterNetworkSubnetReservedIP() result:") + // begin-create_cluster_network_subnet_reserved_ip + + createClusterNetworkSubnetReservedIPOptions := vpcService.NewCreateClusterNetworkSubnetReservedIPOptions( + clusterNetworkID, + clusterNetworkSubnetID, + ) + createClusterNetworkSubnetReservedIPOptions.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + clusterNetworkSubnetReservedIP, response, err := vpcService.CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptions) + if err != nil { + panic(err) + } + + // end-create_cluster_network_subnet_reserved_ip + clusterNetworkSubnetReservedIpID = *clusterNetworkSubnetReservedIP.ID + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(clusterNetworkSubnetReservedIP).ToNot(BeNil()) + }) + It(`GetClusterNetworkSubnetReservedIP request example`, func() { + fmt.Println("\nGetClusterNetworkSubnetReservedIP() result:") + // begin-get_cluster_network_subnet_reserved_ip + + getClusterNetworkSubnetReservedIPOptions := vpcService.NewGetClusterNetworkSubnetReservedIPOptions( + clusterNetworkID, + clusterNetworkSubnetID, + clusterNetworkSubnetReservedIpID, + ) + + clusterNetworkSubnetReservedIP, response, err := vpcService.GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptions) + if err != nil { + panic(err) + } + + // end-get_cluster_network_subnet_reserved_ip + clusterNetworkSubnetReservedIpID = *clusterNetworkSubnetReservedIP.ID + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetworkSubnetReservedIP).ToNot(BeNil()) + }) + It(`UpdateClusterNetworkSubnetReservedIP request example`, func() { + fmt.Println("\nUpdateClusterNetworkSubnetReservedIP() result:") + // begin-update_cluster_network_subnet_reserved_ip + + clusterNetworkSubnetReservedIPPatchModel := &vpcv1.ClusterNetworkSubnetReservedIPPatch{} + clusterNetworkSubnetReservedIPPatchModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip-updated") + clusterNetworkSubnetReservedIPPatchModelAsPatch, asPatchErr := clusterNetworkSubnetReservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateClusterNetworkSubnetReservedIPOptions := vpcService.NewUpdateClusterNetworkSubnetReservedIPOptions( + clusterNetworkID, + clusterNetworkSubnetID, + clusterNetworkSubnetReservedIpID, + clusterNetworkSubnetReservedIPPatchModelAsPatch, + ) + updateClusterNetworkSubnetReservedIPOptions.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + + clusterNetworkSubnetReservedIP, response, err := vpcService.UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptions) + if err != nil { + panic(err) + } + // end-update_cluster_network_subnet_reserved_ip + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetworkSubnetReservedIP).ToNot(BeNil()) + }) + It(`GetClusterNetworkSubnet request example`, func() { + fmt.Println("\nGetClusterNetworkSubnet() result:") + // begin-get_cluster_network_subnet + + getClusterNetworkSubnetOptions := vpcService.NewGetClusterNetworkSubnetOptions( + clusterNetworkID, + clusterNetworkSubnetID, + ) + + clusterNetworkSubnet, response, err := vpcService.GetClusterNetworkSubnet(getClusterNetworkSubnetOptions) + if err != nil { + panic(err) + } + + // end-get_cluster_network_subnet + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetworkSubnet).ToNot(BeNil()) + }) + It(`UpdateClusterNetworkSubnet request example`, func() { + fmt.Println("\nUpdateClusterNetworkSubnet() result:") + // begin-update_cluster_network_subnet + + clusterNetworkSubnetPatchModel := &vpcv1.ClusterNetworkSubnetPatch{} + clusterNetworkSubnetPatchModel.Name = core.StringPtr("my-cluster-network-subnet-updated") + clusterNetworkSubnetPatchModelAsPatch, asPatchErr := clusterNetworkSubnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateClusterNetworkSubnetOptions := vpcService.NewUpdateClusterNetworkSubnetOptions( + clusterNetworkID, + clusterNetworkSubnetID, + clusterNetworkSubnetPatchModelAsPatch, + ) + updateClusterNetworkSubnetOptions.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + + clusterNetworkSubnet, response, err := vpcService.UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptions) + if err != nil { + panic(err) + } + + // end-update_cluster_network_subnet + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetworkSubnet).ToNot(BeNil()) + }) + It(`GetClusterNetwork request example`, func() { + fmt.Println("\nGetClusterNetwork() result:") + // begin-get_cluster_network + + getClusterNetworkOptions := vpcService.NewGetClusterNetworkOptions( + clusterNetworkID, + ) + + clusterNetwork, response, err := vpcService.GetClusterNetwork(getClusterNetworkOptions) + if err != nil { + panic(err) + } + + // end-get_cluster_network + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetwork).ToNot(BeNil()) + }) + It(`UpdateClusterNetwork request example`, func() { + fmt.Println("\nUpdateClusterNetwork() result:") + // begin-update_cluster_network + + clusterNetworkPatchModel := &vpcv1.ClusterNetworkPatch{} + clusterNetworkPatchModel.Name = core.StringPtr("my-cluster-network-updated") + clusterNetworkPatchModelAsPatch, asPatchErr := clusterNetworkPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateClusterNetworkOptions := vpcService.NewUpdateClusterNetworkOptions( + clusterNetworkID, + clusterNetworkPatchModelAsPatch, + ) + updateClusterNetworkOptions.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + + clusterNetwork, response, err := vpcService.UpdateClusterNetwork(updateClusterNetworkOptions) + if err != nil { + panic(err) + } + + // end-update_cluster_network + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterNetwork).ToNot(BeNil()) + }) + It(`ListPublicGateways request example`, func() { fmt.Println("\nListPublicGateways() result:") // begin-list_public_gateways @@ -7029,6 +7550,26 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { Expect(response.StatusCode).To(Equal(204)) }) + It(`DeleteInstanceClusterNetworkAttachment request example`, func() { + fmt.Println("\nDeleteInstanceClusterNetworkAttachment() result:") + // begin-delete_instance_cluster_network_attachment + + deleteInstanceClusterNetworkAttachmentOptions := vpcService.NewDeleteInstanceClusterNetworkAttachmentOptions( + instanceID, + instanceClusterNetworkAttachmentID, + ) + + instanceClusterNetworkAttachment, response, err := vpcService.DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptions) + if err != nil { + panic(err) + } + + // end-delete_instance_cluster_network_attachment + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(instanceClusterNetworkAttachment).ToNot(BeNil()) + }) It(`DeleteInstanceNetworkInterface request example`, func() { // begin-delete_instance_network_interface @@ -7422,6 +7963,90 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { Expect(response.StatusCode).To(Equal(204)) }) + It(`DeleteClusterNetworkInterface request example`, func() { + fmt.Println("\nDeleteClusterNetworkInterface() result:") + // begin-delete_cluster_network_interface + + deleteClusterNetworkInterfaceOptions := vpcService.NewDeleteClusterNetworkInterfaceOptions( + clusterNetworkID, + clusterNetworkInterfaceID, + ) + deleteClusterNetworkInterfaceOptions.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + + clusterNetworkInterface, response, err := vpcService.DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptions) + if err != nil { + panic(err) + } + + // end-delete_cluster_network_interface + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(clusterNetworkInterface).ToNot(BeNil()) + }) + It(`DeleteClusterNetworkSubnetReservedIP request example`, func() { + fmt.Println("\nDeleteClusterNetworkSubnetReservedIP() result:") + // begin-delete_cluster_network_subnet_reserved_ip + + deleteClusterNetworkSubnetReservedIPOptions := vpcService.NewDeleteClusterNetworkSubnetReservedIPOptions( + clusterNetworkID, + clusterNetworkSubnetID, + clusterNetworkSubnetReservedIpID, + ) + deleteClusterNetworkSubnetReservedIPOptions.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + + clusterNetworkSubnetReservedIP, response, err := vpcService.DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptions) + if err != nil { + panic(err) + } + + // end-delete_cluster_network_subnet_reserved_ip + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(clusterNetworkSubnetReservedIP).ToNot(BeNil()) + }) + It(`DeleteClusterNetworkSubnet request example`, func() { + fmt.Println("\nDeleteClusterNetworkSubnet() result:") + // begin-delete_cluster_network_subnet + + deleteClusterNetworkSubnetOptions := vpcService.NewDeleteClusterNetworkSubnetOptions( + clusterNetworkID, + clusterNetworkSubnetID, + ) + deleteClusterNetworkSubnetOptions.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + + clusterNetworkSubnet, response, err := vpcService.DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptions) + if err != nil { + panic(err) + } + + // end-delete_cluster_network_subnet + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(clusterNetworkSubnet).ToNot(BeNil()) + }) + It(`DeleteClusterNetwork request example`, func() { + fmt.Println("\nDeleteClusterNetwork() result:") + // begin-delete_cluster_network + + deleteClusterNetworkOptions := vpcService.NewDeleteClusterNetworkOptions( + clusterNetworkID, + ) + deleteClusterNetworkOptions.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + + clusterNetwork, response, err := vpcService.DeleteClusterNetwork(deleteClusterNetworkOptions) + if err != nil { + panic(err) + } + + // end-delete_cluster_network + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(clusterNetwork).ToNot(BeNil()) + }) It(`DeletePublicGateway request example`, func() { // begin-delete_public_gateway diff --git a/vpcv1/vpc_v1_test.go b/vpcv1/vpc_v1_test.go index 650aaff..067c077 100644 --- a/vpcv1/vpc_v1_test.go +++ b/vpcv1/vpc_v1_test.go @@ -260,7 +260,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": false, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": false, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}`) })) }) It(`Invoke ListVpcs successfully with retries`, func() { @@ -324,7 +324,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": false, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "vpcs": [{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "cse_source_ips": [{"ip": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "default_network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "dns": {"enable_hub": false, "resolution_binding_count": 0, "resolver": {"servers": [{"address": "192.168.3.4", "zone_affinity": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "type": "delegated", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}}, "health_reasons": [{"code": "dns_resolution_binding_failed", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpc", "status": "available"}]}`) })) }) It(`Invoke ListVpcs successfully`, func() { @@ -427,7 +427,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.VPCCollection) - nextObject := new(vpcv1.VPCCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -444,7 +444,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.VPCCollection) - nextObject := new(vpcv1.VPCCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -2164,7 +2164,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "observant-chip-emphatic-engraver", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "observant-chip-emphatic-engraver", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke GetVPCDefaultSecurityGroup successfully with retries`, func() { @@ -2221,7 +2221,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "observant-chip-emphatic-engraver", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "observant-chip-emphatic-engraver", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke GetVPCDefaultSecurityGroup successfully`, func() { @@ -2395,7 +2395,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/address_prefixes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "name": "my-address-prefix-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/a4e28308-8ee7-46ab-8108-9f881f22bdbf/address_prefixes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/a4e28308-8ee7-46ab-8108-9f881f22bdbf/address_prefixes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/address_prefixes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "name": "my-address-prefix-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListVPCAddressPrefixes successfully with retries`, func() { @@ -2456,7 +2456,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/address_prefixes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "name": "my-address-prefix-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/a4e28308-8ee7-46ab-8108-9f881f22bdbf/address_prefixes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/a4e28308-8ee7-46ab-8108-9f881f22bdbf/address_prefixes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"address_prefixes": [{"cidr": "192.168.3.0/24", "created_at": "2019-01-01T12:00:00.000Z", "has_subnets": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/address_prefixes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "name": "my-address-prefix-1", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListVPCAddressPrefixes successfully`, func() { @@ -2563,7 +2563,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.AddressPrefixCollection) - nextObject := new(vpcv1.AddressPrefixCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -2580,7 +2580,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.AddressPrefixCollection) - nextObject := new(vpcv1.AddressPrefixCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -3658,7 +3658,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListVPCDnsResolutionBindings successfully with retries`, func() { @@ -3729,7 +3729,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"dns_resolution_bindings": [{"created_at": "2019-01-01T12:00:00.000Z", "endpoint_gateways": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "endpoint_gateway"}], "health_reasons": [{"code": "disconnected_from_bound_vpc", "message": "The VPC specified in the DNS resolution binding has been disconnected.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshoot-hub-1"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/dns_resolution_bindings/r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "id": "r006-8a524686-fcf6-4947-a59b-188c1ed78ad1", "lifecycle_state": "stable", "name": "my-dns-resolution-binding", "resource_type": "vpc_dns_resolution_binding", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "vpc"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListVPCDnsResolutionBindings successfully`, func() { @@ -3851,7 +3851,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.VpcdnsResolutionBindingCollection) - nextObject := new(vpcv1.VpcdnsResolutionBindingCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -3868,7 +3868,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.VpcdnsResolutionBindingCollection) - nextObject := new(vpcv1.VpcdnsResolutionBindingCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -5084,7 +5084,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutes successfully with retries`, func() { @@ -5147,7 +5147,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutes successfully`, func() { @@ -5257,7 +5257,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.RouteCollectionVPCContext) - nextObject := new(vpcv1.RouteCollectionVPCContextNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -5274,7 +5274,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.RouteCollectionVPCContext) - nextObject := new(vpcv1.RouteCollectionVPCContextNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -5298,9 +5298,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"ddf51bec-3424-11e8-b467-0ed5f89f718b","name":"my-vpn-gateway","resource_type":"vpn_gateway"},"destination":"192.168.3.0/24","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_state":"stable","name":"my-route-1","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"ddf51bec-3424-11e8-b467-0ed5f89f718b","name":"my-vpn-gateway","resource_type":"vpn_gateway"},"destination":"192.168.3.0/24","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_state":"stable","name":"my-route-1","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"ddf51bec-3424-11e8-b467-0ed5f89f718b","name":"my-vpn-gateway","resource_type":"vpn_gateway"},"destination":"192.168.3.0/24","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_state":"stable","name":"my-route-1","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"routes":[{"action":"delegate","advertise":false,"created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"ddf51bec-3424-11e8-b467-0ed5f89f718b","name":"my-vpn-gateway","resource_type":"vpn_gateway"},"destination":"192.168.3.0/24","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","lifecycle_state":"stable","name":"my-route-1","next_hop":{"address":"192.168.3.4"},"origin":"service","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -5325,7 +5325,7 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.RouteCollectionVPCContextRoutesItem + var allResults []vpcv1.Route for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -6407,7 +6407,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": true, "route_internet_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": true, "route_internet_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTables successfully with retries`, func() { @@ -6470,7 +6470,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": true, "route_internet_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_server"}], "advertise_routes_to": ["transit_gateway"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "routing_table", "route_direct_link_ingress": true, "route_internet_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTables successfully`, func() { @@ -6580,7 +6580,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.RoutingTableCollection) - nextObject := new(vpcv1.RoutingTableCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -6597,7 +6597,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.RoutingTableCollection) - nextObject := new(vpcv1.RoutingTableCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -7833,7 +7833,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTableRoutes successfully with retries`, func() { @@ -7895,7 +7895,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "routes": [{"action": "delegate", "advertise": false, "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "priority": 1, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTableRoutes successfully`, func() { @@ -8005,7 +8005,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.RouteCollection) - nextObject := new(vpcv1.RouteCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -8022,7 +8022,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.RouteCollection) - nextObject := new(vpcv1.RouteCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -9189,7 +9189,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListSubnets successfully with retries`, func() { @@ -9263,7 +9263,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "name": "my-subnet", "network_acl": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_type": "public_gateway"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "subnet", "routing_table": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc-routing-table:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b/routing_tables/r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "r006-6885e83f-03b2-4603-8a86-db2a0f55c840", "name": "my-routing-table-1", "resource_type": "routing_table"}, "status": "available", "total_ipv4_address_count": 256, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListSubnets successfully`, func() { @@ -9381,7 +9381,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.SubnetCollection) - nextObject := new(vpcv1.SubnetCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -9398,7 +9398,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.SubnetCollection) - nextObject := new(vpcv1.SubnetCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -11245,7 +11245,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetSubnetPublicGateway successfully with retries`, func() { @@ -11302,7 +11302,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetSubnetPublicGateway successfully`, func() { @@ -11491,7 +11491,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke SetSubnetPublicGateway successfully with retries`, func() { @@ -11569,7 +11569,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke SetSubnetPublicGateway successfully`, func() { @@ -12280,7 +12280,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "reserved_ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "reserved_ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}`) })) }) It(`Invoke ListSubnetReservedIps successfully with retries`, func() { @@ -12351,7 +12351,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "reserved_ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "reserved_ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}`) })) }) It(`Invoke ListSubnetReservedIps successfully`, func() { @@ -12473,7 +12473,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.ReservedIPCollection) - nextObject := new(vpcv1.ReservedIPCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -12490,7 +12490,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.ReservedIPCollection) - nextObject := new(vpcv1.ReservedIPCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -13216,7 +13216,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservedIPPatch model reservedIPPatchModel := new(vpcv1.ReservedIPPatch) reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip-updated") reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -13296,7 +13296,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservedIPPatch model reservedIPPatchModel := new(vpcv1.ReservedIPPatch) reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip-updated") reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -13383,7 +13383,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservedIPPatch model reservedIPPatchModel := new(vpcv1.ReservedIPPatch) reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip-updated") reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -13413,7 +13413,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservedIPPatch model reservedIPPatchModel := new(vpcv1.ReservedIPPatch) reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip-updated") reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -13464,7 +13464,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservedIPPatch model reservedIPPatchModel := new(vpcv1.ReservedIPPatch) reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip-updated") reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -13573,7 +13573,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?limit=20"}, "images": [{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "images": [{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListImages successfully with retries`, func() { @@ -13641,7 +13641,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?limit=20"}, "images": [{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "images": [{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deprecation_at": "2019-01-01T12:00:00.000Z", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "file": {"checksums": {"sha256": "e992a84f113d3a35d2145ca3e7aca4fc95fe6daf470a08d8af3422ee59c92e15"}, "size": 1}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "obsolescence_at": "2019-01-01T12:00:00.000Z", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "image", "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_data_format": "cloud_init", "visibility": "private"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListImages successfully`, func() { @@ -13753,7 +13753,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.ImageCollection) - nextObject := new(vpcv1.ImageCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -13770,7 +13770,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.ImageCollection) - nextObject := new(vpcv1.ImageCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -16201,7 +16201,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "operating_systems": [{"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "operating_systems": [{"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}`) })) }) It(`Invoke ListOperatingSystems successfully with retries`, func() { @@ -16261,7 +16261,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "operating_systems": [{"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "operating_systems": [{"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}], "total_count": 132}`) })) }) It(`Invoke ListOperatingSystems successfully`, func() { @@ -16358,7 +16358,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.OperatingSystemCollection) - nextObject := new(vpcv1.OperatingSystemCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -16375,7 +16375,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.OperatingSystemCollection) - nextObject := new(vpcv1.OperatingSystemCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -16697,6 +16697,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) @@ -16715,6 +16716,7 @@ var _ = Describe(`VpcV1`, func() { listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) + listKeysOptionsModel.ResourceGroupID = core.StringPtr("testString") listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := vpcService.ListKeys(listKeysOptionsModel) @@ -16750,13 +16752,14 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/keys?limit=20"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/keys?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListKeys successfully with retries`, func() { @@ -16773,6 +16776,7 @@ var _ = Describe(`VpcV1`, func() { listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) + listKeysOptionsModel.ResourceGroupID = core.StringPtr("testString") listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -16813,10 +16817,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/keys?limit=20"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/keys?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListKeys successfully`, func() { @@ -16838,6 +16843,7 @@ var _ = Describe(`VpcV1`, func() { listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) + listKeysOptionsModel.ResourceGroupID = core.StringPtr("testString") listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -16860,6 +16866,7 @@ var _ = Describe(`VpcV1`, func() { listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) + listKeysOptionsModel.ResourceGroupID = core.StringPtr("testString") listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -16896,6 +16903,7 @@ var _ = Describe(`VpcV1`, func() { listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) + listKeysOptionsModel.ResourceGroupID = core.StringPtr("testString") listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -16913,7 +16921,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.KeyCollection) - nextObject := new(vpcv1.KeyCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -16930,7 +16938,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.KeyCollection) - nextObject := new(vpcv1.KeyCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -16954,9 +16962,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45","id":"82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45","id":"82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45","id":"r006-82679077-ac3b-4c10-be16-63e9c21f0f45","length":2048,"name":"my-key-1","public_key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"type":"ed25519"}],"limit":1}`) } else { res.WriteHeader(400) } @@ -16972,7 +16980,8 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) listKeysOptionsModel := &vpcv1.ListKeysOptions{ - Limit: core.Int64Ptr(int64(10)), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), } pager, err := vpcService.NewKeysPager(listKeysOptionsModel) @@ -16998,7 +17007,8 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) listKeysOptionsModel := &vpcv1.ListKeysOptions{ - Limit: core.Int64Ptr(int64(10)), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), } pager, err := vpcService.NewKeysPager(listKeysOptionsModel) @@ -17104,7 +17114,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) })) }) It(`Invoke CreateKey successfully with retries`, func() { @@ -17184,7 +17194,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) })) }) It(`Invoke CreateKey successfully`, func() { @@ -17446,7 +17456,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) })) }) It(`Invoke GetKey successfully with retries`, func() { @@ -17503,7 +17513,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) })) }) It(`Invoke GetKey successfully`, func() { @@ -17694,7 +17704,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) })) }) It(`Invoke UpdateKey successfully with retries`, func() { @@ -17774,7 +17784,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "length": 2048, "name": "my-key-1", "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "type": "ed25519"}`) })) }) It(`Invoke UpdateKey successfully`, func() { @@ -17962,7 +17972,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "intel", "type": "fixed", "value": "intel"}}]}`) + fmt.Fprintf(res, "%s", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "intel", "type": "fixed", "value": "intel"}}]}`) })) }) It(`Invoke ListInstanceProfiles successfully with retries`, func() { @@ -18018,7 +18028,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "intel", "type": "fixed", "value": "intel"}}]}`) + fmt.Fprintf(res, "%s", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "intel", "type": "fixed", "value": "intel"}}]}`) })) }) It(`Invoke ListInstanceProfiles successfully`, func() { @@ -18176,7 +18186,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "intel", "type": "fixed", "value": "intel"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "intel", "type": "fixed", "value": "intel"}}`) })) }) It(`Invoke GetInstanceProfile successfully with retries`, func() { @@ -18233,7 +18243,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "intel", "type": "fixed", "value": "intel"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "cluster_network_attachment_count": {"type": "dependent"}, "confidential_compute_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "reservation_terms": {"type": "enum", "values": ["one_year"]}, "resource_type": "instance_profile", "secure_boot_modes": {"default": false, "type": "enum", "values": [true]}, "status": "current", "supported_cluster_network_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}], "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "intel", "type": "fixed", "value": "intel"}}`) })) }) It(`Invoke GetInstanceProfile successfully`, func() { @@ -18400,7 +18410,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}`) })) }) It(`Invoke ListInstanceTemplates successfully with retries`, func() { @@ -18456,7 +18466,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}`) })) }) It(`Invoke ListInstanceTemplates successfully`, func() { @@ -18576,8 +18586,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -18605,7 +18637,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -18670,7 +18702,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -18687,6 +18719,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface model instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instanceTemplatePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instanceTemplatePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -18765,7 +18798,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke CreateInstanceTemplate successfully with retries`, func() { @@ -18782,8 +18815,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -18811,7 +18866,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -18876,7 +18931,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -18893,6 +18948,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface model instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instanceTemplatePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instanceTemplatePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -18973,7 +19029,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke CreateInstanceTemplate successfully`, func() { @@ -18995,8 +19051,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -19024,7 +19102,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -19089,7 +19167,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -19106,6 +19184,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface model instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instanceTemplatePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instanceTemplatePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -19151,8 +19230,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -19180,7 +19281,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -19245,7 +19346,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -19262,6 +19363,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface model instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instanceTemplatePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instanceTemplatePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -19328,8 +19430,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -19357,7 +19481,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -19422,7 +19546,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -19439,6 +19563,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface model instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instanceTemplatePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instanceTemplatePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -19619,7 +19744,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke GetInstanceTemplate successfully with retries`, func() { @@ -19676,7 +19801,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke GetInstanceTemplate successfully`, func() { @@ -19867,7 +19992,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke UpdateInstanceTemplate successfully with retries`, func() { @@ -19947,7 +20072,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "cluster_network_attachments": [{"cluster_network_interface": {"auto_delete": false, "name": "my-cluster-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "subnet": {"id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"}}, "name": "my-instance-network-attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "enable_secure_boot": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "reservation_affinity": {"policy": "disabled", "pool": [{"id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "protocol_state_filtering_mode": "auto", "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke UpdateInstanceTemplate successfully`, func() { @@ -20084,6 +20209,9 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["cluster_network.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["cluster_network.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94"})) + Expect(req.URL.Query()["cluster_network.name"]).To(Equal([]string{"my-cluster-network"})) Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a"})) Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"my-dedicated-host"})) @@ -20116,6 +20244,9 @@ var _ = Describe(`VpcV1`, func() { listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("my-name") + listInstancesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listInstancesOptionsModel.ClusterNetworkCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94") + listInstancesOptionsModel.ClusterNetworkName = core.StringPtr("my-cluster-network") listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a") listInstancesOptionsModel.DedicatedHostName = core.StringPtr("my-dedicated-host") @@ -20165,6 +20296,9 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["cluster_network.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["cluster_network.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94"})) + Expect(req.URL.Query()["cluster_network.name"]).To(Equal([]string{"my-cluster-network"})) Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a"})) Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"my-dedicated-host"})) @@ -20183,7 +20317,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?limit=20"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListInstances successfully with retries`, func() { @@ -20202,6 +20336,9 @@ var _ = Describe(`VpcV1`, func() { listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("my-name") + listInstancesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listInstancesOptionsModel.ClusterNetworkCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94") + listInstancesOptionsModel.ClusterNetworkName = core.StringPtr("my-cluster-network") listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a") listInstancesOptionsModel.DedicatedHostName = core.StringPtr("my-dedicated-host") @@ -20256,6 +20393,9 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["cluster_network.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["cluster_network.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94"})) + Expect(req.URL.Query()["cluster_network.name"]).To(Equal([]string{"my-cluster-network"})) Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a"})) Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"my-dedicated-host"})) @@ -20271,7 +20411,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?limit=20"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListInstances successfully`, func() { @@ -20295,6 +20435,9 @@ var _ = Describe(`VpcV1`, func() { listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("my-name") + listInstancesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listInstancesOptionsModel.ClusterNetworkCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94") + listInstancesOptionsModel.ClusterNetworkName = core.StringPtr("my-cluster-network") listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a") listInstancesOptionsModel.DedicatedHostName = core.StringPtr("my-dedicated-host") @@ -20331,6 +20474,9 @@ var _ = Describe(`VpcV1`, func() { listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("my-name") + listInstancesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listInstancesOptionsModel.ClusterNetworkCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94") + listInstancesOptionsModel.ClusterNetworkName = core.StringPtr("my-cluster-network") listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a") listInstancesOptionsModel.DedicatedHostName = core.StringPtr("my-dedicated-host") @@ -20381,6 +20527,9 @@ var _ = Describe(`VpcV1`, func() { listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("my-name") + listInstancesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listInstancesOptionsModel.ClusterNetworkCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94") + listInstancesOptionsModel.ClusterNetworkName = core.StringPtr("my-cluster-network") listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a") listInstancesOptionsModel.DedicatedHostName = core.StringPtr("my-dedicated-host") @@ -20410,7 +20559,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.InstanceCollection) - nextObject := new(vpcv1.InstanceCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -20427,7 +20576,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.InstanceCollection) - nextObject := new(vpcv1.InstanceCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -20451,9 +20600,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a","id":"0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"7187-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"disabled","pool":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"7187-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"ID"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"disabled","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"ID"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a","id":"0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"7187-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"disabled","pool":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"7187-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"ID"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"cluster_network":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","name":"my-cluster-network","resource_type":"cluster_network"},"cluster_network_attachments":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"confidential_compute_mode":"disabled","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"enable_secure_boot":true,"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"health_reasons":[{"code":"reservation_expired","message":"The reservation cannot be used because it has expired.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":64,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"instance_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"reservation":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"},"reservation_affinity":{"policy":"disabled","pool":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","name":"my-reservation","resource_type":"reservation"}]},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"ID"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -20472,6 +20621,9 @@ var _ = Describe(`VpcV1`, func() { Limit: core.Int64Ptr(int64(10)), ResourceGroupID: core.StringPtr("testString"), Name: core.StringPtr("my-name"), + ClusterNetworkID: core.StringPtr("testString"), + ClusterNetworkCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94"), + ClusterNetworkName: core.StringPtr("my-cluster-network"), DedicatedHostID: core.StringPtr("testString"), DedicatedHostCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a"), DedicatedHostName: core.StringPtr("my-dedicated-host"), @@ -20512,6 +20664,9 @@ var _ = Describe(`VpcV1`, func() { Limit: core.Int64Ptr(int64(10)), ResourceGroupID: core.StringPtr("testString"), Name: core.StringPtr("my-name"), + ClusterNetworkID: core.StringPtr("testString"), + ClusterNetworkCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94"), + ClusterNetworkName: core.StringPtr("my-cluster-network"), DedicatedHostID: core.StringPtr("testString"), DedicatedHostCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a"), DedicatedHostName: core.StringPtr("my-dedicated-host"), @@ -20568,8 +20723,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -20597,7 +20774,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -20668,7 +20845,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -20685,6 +20862,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface model instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instancePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instancePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -20763,7 +20941,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateInstance successfully with retries`, func() { @@ -20780,8 +20958,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -20809,7 +21009,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -20880,7 +21080,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -20897,6 +21097,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface model instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instancePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instancePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -20977,7 +21178,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateInstance successfully`, func() { @@ -20999,8 +21200,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -21028,7 +21251,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -21099,7 +21322,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -21116,6 +21339,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface model instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instancePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instancePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -21161,8 +21385,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -21190,7 +21436,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -21261,7 +21507,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -21278,6 +21524,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface model instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instancePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instancePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -21344,8 +21591,30 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") // Construct an instance of the InstanceDefaultTrustedProfilePrototype model @@ -21373,7 +21642,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -21444,7 +21713,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -21461,6 +21730,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface model instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instancePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instancePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -21645,7 +21915,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetInstance successfully with retries`, func() { @@ -21702,7 +21972,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetInstance successfully`, func() { @@ -21850,7 +22120,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPatch model instanceReservationAffinityPatchModel := new(vpcv1.InstanceReservationAffinityPatch) @@ -21933,7 +22203,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateInstance successfully with retries`, func() { @@ -21966,7 +22236,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPatch model instanceReservationAffinityPatchModel := new(vpcv1.InstanceReservationAffinityPatch) @@ -22051,7 +22321,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "cluster_network": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "name": "my-cluster-network", "resource_type": "cluster_network"}, "cluster_network_attachments": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "confidential_compute_mode": "disabled", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "enable_secure_boot": true, "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "health_reasons": [{"code": "reservation_expired", "message": "The reservation cannot be used because it has expired.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 64, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "reservation": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}, "reservation_affinity": {"policy": "disabled", "pool": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "name": "my-reservation", "resource_type": "reservation"}]}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateInstance successfully`, func() { @@ -22089,7 +22359,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPatch model instanceReservationAffinityPatchModel := new(vpcv1.InstanceReservationAffinityPatch) @@ -22153,7 +22423,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPatch model instanceReservationAffinityPatchModel := new(vpcv1.InstanceReservationAffinityPatch) @@ -22238,7 +22508,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") // Construct an instance of the InstanceReservationAffinityPatch model instanceReservationAffinityPatchModel := new(vpcv1.InstanceReservationAffinityPatch) @@ -22348,7 +22618,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "password": {"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}`) + fmt.Fprintf(res, "%s", `{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "password": {"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}`) })) }) It(`Invoke GetInstanceInitialization successfully with retries`, func() { @@ -22405,7 +22675,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "password": {"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}`) + fmt.Fprintf(res, "%s", `{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5", "resource_type": "trusted_profile"}}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "password": {"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}`) })) }) It(`Invoke GetInstanceInitialization successfully`, func() { @@ -22591,7 +22861,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "force": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/actions/109a1b6e-1242-4de1-be44-38705e9474ed", "id": "109a1b6e-1242-4de1-be44-38705e9474ed", "started_at": "2019-01-01T12:00:00.000Z", "status": "completed", "type": "reboot"}`) + fmt.Fprintf(res, "%s", `{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "force": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/actions/109a1b6e-1242-4de1-be44-38705e9474ed", "id": "109a1b6e-1242-4de1-be44-38705e9474ed", "started_at": "2019-01-01T12:00:00.000Z", "status": "completed", "type": "reboot"}`) })) }) It(`Invoke CreateInstanceAction successfully with retries`, func() { @@ -22666,7 +22936,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "force": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/actions/109a1b6e-1242-4de1-be44-38705e9474ed", "id": "109a1b6e-1242-4de1-be44-38705e9474ed", "started_at": "2019-01-01T12:00:00.000Z", "status": "completed", "type": "reboot"}`) + fmt.Fprintf(res, "%s", `{"completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "force": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/actions/109a1b6e-1242-4de1-be44-38705e9474ed", "id": "109a1b6e-1242-4de1-be44-38705e9474ed", "started_at": "2019-01-01T12:00:00.000Z", "status": "completed", "type": "reboot"}`) })) }) It(`Invoke CreateInstanceAction successfully`, func() { @@ -22771,25 +23041,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) - Operation response error`, func() { + Describe(`ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptions *ListInstanceClusterNetworkAttachmentsOptions) - Operation response error`, func() { version := "2024-06-23" - createInstanceConsoleAccessTokenPath := "/instances/testString/console_access_token" + listInstanceClusterNetworkAttachmentsPath := "/instances/testString/cluster_network_attachments" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceConsoleAccessTokenPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceClusterNetworkAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceConsoleAccessToken with error: Operation response processing error`, func() { + It(`Invoke ListInstanceClusterNetworkAttachments with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -22798,21 +23070,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model - createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) - createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceClusterNetworkAttachmentsOptions model + listInstanceClusterNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceClusterNetworkAttachmentsOptions) + listInstanceClusterNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceClusterNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + result, response, operationErr = vpcService.ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -22822,16 +23094,380 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions)`, func() { + Describe(`ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptions *ListInstanceClusterNetworkAttachmentsOptions)`, func() { version := "2024-06-23" - createInstanceConsoleAccessTokenPath := "/instances/testString/console_access_token" + listInstanceClusterNetworkAttachmentsPath := "/instances/testString/cluster_network_attachments" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceConsoleAccessTokenPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceClusterNetworkAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"cluster_network_attachments": [{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListInstanceClusterNetworkAttachments successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListInstanceClusterNetworkAttachmentsOptions model + listInstanceClusterNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceClusterNetworkAttachmentsOptions) + listInstanceClusterNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceClusterNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListInstanceClusterNetworkAttachmentsWithContext(ctx, listInstanceClusterNetworkAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListInstanceClusterNetworkAttachmentsWithContext(ctx, listInstanceClusterNetworkAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listInstanceClusterNetworkAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"cluster_network_attachments": [{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListInstanceClusterNetworkAttachments successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListInstanceClusterNetworkAttachments(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListInstanceClusterNetworkAttachmentsOptions model + listInstanceClusterNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceClusterNetworkAttachmentsOptions) + listInstanceClusterNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceClusterNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceClusterNetworkAttachments with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListInstanceClusterNetworkAttachmentsOptions model + listInstanceClusterNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceClusterNetworkAttachmentsOptions) + listInstanceClusterNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceClusterNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListInstanceClusterNetworkAttachmentsOptions model with no property values + listInstanceClusterNetworkAttachmentsOptionsModelNew := new(vpcv1.ListInstanceClusterNetworkAttachmentsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListInstanceClusterNetworkAttachments successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListInstanceClusterNetworkAttachmentsOptions model + listInstanceClusterNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceClusterNetworkAttachmentsOptions) + listInstanceClusterNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceClusterNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceClusterNetworkAttachments(listInstanceClusterNetworkAttachmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.InstanceClusterNetworkAttachmentCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.InstanceClusterNetworkAttachmentCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.InstanceClusterNetworkAttachmentCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listInstanceClusterNetworkAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"cluster_network_attachments":[{"before":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"cluster_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"}},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"}],"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use InstanceClusterNetworkAttachmentsPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listInstanceClusterNetworkAttachmentsOptionsModel := &vpcv1.ListInstanceClusterNetworkAttachmentsOptions{ + InstanceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceClusterNetworkAttachmentsPager(listInstanceClusterNetworkAttachmentsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.InstanceClusterNetworkAttachment + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use InstanceClusterNetworkAttachmentsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listInstanceClusterNetworkAttachmentsOptionsModel := &vpcv1.ListInstanceClusterNetworkAttachmentsOptions{ + InstanceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceClusterNetworkAttachmentsPager(listInstanceClusterNetworkAttachmentsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptions *CreateClusterNetworkAttachmentOptions) - Operation response error`, func() { + version := "2024-06-23" + createClusterNetworkAttachmentPath := "/instances/testString/cluster_network_attachments" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkAttachmentPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateClusterNetworkAttachment with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID model + instanceClusterNetworkAttachmentBeforePrototypeModel := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) + instanceClusterNetworkAttachmentBeforePrototypeModel.ID = core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213") + + // Construct an instance of the CreateClusterNetworkAttachmentOptions model + createClusterNetworkAttachmentOptionsModel := new(vpcv1.CreateClusterNetworkAttachmentOptions) + createClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createClusterNetworkAttachmentOptionsModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + createClusterNetworkAttachmentOptionsModel.Before = instanceClusterNetworkAttachmentBeforePrototypeModel + createClusterNetworkAttachmentOptionsModel.Name = core.StringPtr("my-instance-network-attachment") + createClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptions *CreateClusterNetworkAttachmentOptions)`, func() { + version := "2024-06-23" + createClusterNetworkAttachmentPath := "/instances/testString/cluster_network_attachments" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -22857,11 +23493,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}`) })) }) - It(`Invoke CreateInstanceConsoleAccessToken successfully with retries`, func() { + It(`Invoke CreateClusterNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -22871,23 +23507,45 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model - createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) - createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID model + instanceClusterNetworkAttachmentBeforePrototypeModel := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) + instanceClusterNetworkAttachmentBeforePrototypeModel.ID = core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213") + + // Construct an instance of the CreateClusterNetworkAttachmentOptions model + createClusterNetworkAttachmentOptionsModel := new(vpcv1.CreateClusterNetworkAttachmentOptions) + createClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createClusterNetworkAttachmentOptionsModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + createClusterNetworkAttachmentOptionsModel.Before = instanceClusterNetworkAttachmentBeforePrototypeModel + createClusterNetworkAttachmentOptionsModel.Name = core.StringPtr("my-instance-network-attachment") + createClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateInstanceConsoleAccessTokenWithContext(ctx, createInstanceConsoleAccessTokenOptionsModel) + _, _, operationErr := vpcService.CreateClusterNetworkAttachmentWithContext(ctx, createClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -22895,7 +23553,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceConsoleAccessTokenWithContext(ctx, createInstanceConsoleAccessTokenOptionsModel) + _, _, operationErr = vpcService.CreateClusterNetworkAttachmentWithContext(ctx, createClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -22909,7 +23567,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceConsoleAccessTokenPath)) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -22932,11 +23590,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}`) })) }) - It(`Invoke CreateInstanceConsoleAccessToken successfully`, func() { + It(`Invoke CreateClusterNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -22946,26 +23604,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(nil) + result, response, operationErr := vpcService.CreateClusterNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model - createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) - createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID model + instanceClusterNetworkAttachmentBeforePrototypeModel := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) + instanceClusterNetworkAttachmentBeforePrototypeModel.ID = core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213") + + // Construct an instance of the CreateClusterNetworkAttachmentOptions model + createClusterNetworkAttachmentOptionsModel := new(vpcv1.CreateClusterNetworkAttachmentOptions) + createClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createClusterNetworkAttachmentOptionsModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + createClusterNetworkAttachmentOptionsModel.Before = instanceClusterNetworkAttachmentBeforePrototypeModel + createClusterNetworkAttachmentOptionsModel.Name = core.StringPtr("my-instance-network-attachment") + createClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceConsoleAccessToken with error: Operation validation and request error`, func() { + It(`Invoke CreateClusterNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -22974,24 +23654,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model - createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) - createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID model + instanceClusterNetworkAttachmentBeforePrototypeModel := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) + instanceClusterNetworkAttachmentBeforePrototypeModel.ID = core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213") + + // Construct an instance of the CreateClusterNetworkAttachmentOptions model + createClusterNetworkAttachmentOptionsModel := new(vpcv1.CreateClusterNetworkAttachmentOptions) + createClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createClusterNetworkAttachmentOptionsModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + createClusterNetworkAttachmentOptionsModel.Before = instanceClusterNetworkAttachmentBeforePrototypeModel + createClusterNetworkAttachmentOptionsModel.Name = core.StringPtr("my-instance-network-attachment") + createClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateInstanceConsoleAccessTokenOptions model with no property values - createInstanceConsoleAccessTokenOptionsModelNew := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) + // Construct a second instance of the CreateClusterNetworkAttachmentOptions model with no property values + createClusterNetworkAttachmentOptionsModelNew := new(vpcv1.CreateClusterNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModelNew) + result, response, operationErr = vpcService.CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23006,10 +23708,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceConsoleAccessToken successfully`, func() { + It(`Invoke CreateClusterNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23018,15 +23720,37 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model - createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) - createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + + // Construct an instance of the InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID model + instanceClusterNetworkAttachmentBeforePrototypeModel := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) + instanceClusterNetworkAttachmentBeforePrototypeModel.ID = core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213") + + // Construct an instance of the CreateClusterNetworkAttachmentOptions model + createClusterNetworkAttachmentOptionsModel := new(vpcv1.CreateClusterNetworkAttachmentOptions) + createClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createClusterNetworkAttachmentOptionsModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + createClusterNetworkAttachmentOptionsModel.Before = instanceClusterNetworkAttachmentBeforePrototypeModel + createClusterNetworkAttachmentOptionsModel.Name = core.StringPtr("my-instance-network-attachment") + createClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkAttachment(createClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -23038,25 +23762,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) - Operation response error`, func() { + Describe(`DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptions *DeleteInstanceClusterNetworkAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceDisksPath := "/instances/testString/disks" + deleteInstanceClusterNetworkAttachmentPath := "/instances/testString/cluster_network_attachments/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceDisksPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceClusterNetworkAttachmentPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceDisks with error: Operation response processing error`, func() { + It(`Invoke DeleteInstanceClusterNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23065,19 +23789,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceDisksOptions model - listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) - listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceClusterNetworkAttachmentOptions model + deleteInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceClusterNetworkAttachmentOptions) + deleteInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) + result, response, operationErr := vpcService.DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) + result, response, operationErr = vpcService.DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -23087,17 +23812,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions)`, func() { + Describe(`DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptions *DeleteInstanceClusterNetworkAttachmentOptions)`, func() { version := "2024-06-23" - listInstanceDisksPath := "/instances/testString/disks" + deleteInstanceClusterNetworkAttachmentPath := "/instances/testString/cluster_network_attachments/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceDisksPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceClusterNetworkAttachmentPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -23106,11 +23831,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}]}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}`) })) }) - It(`Invoke ListInstanceDisks successfully with retries`, func() { + It(`Invoke DeleteInstanceClusterNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23120,21 +23845,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceDisksOptions model - listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) - listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceClusterNetworkAttachmentOptions model + deleteInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceClusterNetworkAttachmentOptions) + deleteInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceDisksWithContext(ctx, listInstanceDisksOptionsModel) + _, _, operationErr := vpcService.DeleteInstanceClusterNetworkAttachmentWithContext(ctx, deleteInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) + result, response, operationErr := vpcService.DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23142,7 +23868,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceDisksWithContext(ctx, listInstanceDisksOptionsModel) + _, _, operationErr = vpcService.DeleteInstanceClusterNetworkAttachmentWithContext(ctx, deleteInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23156,18 +23882,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceDisksPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceClusterNetworkAttachmentPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}]}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}`) })) }) - It(`Invoke ListInstanceDisks successfully`, func() { + It(`Invoke DeleteInstanceClusterNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23177,24 +23903,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceDisks(nil) + result, response, operationErr := vpcService.DeleteInstanceClusterNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceDisksOptions model - listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) - listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceClusterNetworkAttachmentOptions model + deleteInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceClusterNetworkAttachmentOptions) + deleteInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) + result, response, operationErr = vpcService.DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceDisks with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceClusterNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23203,22 +23930,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceDisksOptions model - listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) - listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceClusterNetworkAttachmentOptions model + deleteInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceClusterNetworkAttachmentOptions) + deleteInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) + result, response, operationErr := vpcService.DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceDisksOptions model with no property values - listInstanceDisksOptionsModelNew := new(vpcv1.ListInstanceDisksOptions) + // Construct a second instance of the DeleteInstanceClusterNetworkAttachmentOptions model with no property values + deleteInstanceClusterNetworkAttachmentOptionsModelNew := new(vpcv1.DeleteInstanceClusterNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModelNew) + result, response, operationErr = vpcService.DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23233,10 +23961,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke ListInstanceDisks successfully`, func() { + It(`Invoke DeleteInstanceClusterNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23245,13 +23973,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceDisksOptions model - listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) - listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceClusterNetworkAttachmentOptions model + deleteInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceClusterNetworkAttachmentOptions) + deleteInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) + result, response, operationErr := vpcService.DeleteInstanceClusterNetworkAttachment(deleteInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -23263,16 +23992,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) - Operation response error`, func() { + Describe(`GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptions *GetInstanceClusterNetworkAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceDiskPath := "/instances/testString/disks/testString" + getInstanceClusterNetworkAttachmentPath := "/instances/testString/cluster_network_attachments/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceClusterNetworkAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -23281,7 +24010,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceDisk with error: Operation response processing error`, func() { + It(`Invoke GetInstanceClusterNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23290,20 +24019,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceDiskOptions model - getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) - getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceDiskOptionsModel.ID = core.StringPtr("testString") - getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceClusterNetworkAttachmentOptions model + getInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceClusterNetworkAttachmentOptions) + getInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) + result, response, operationErr := vpcService.GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) + result, response, operationErr = vpcService.GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -23313,16 +24042,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions)`, func() { + Describe(`GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptions *GetInstanceClusterNetworkAttachmentOptions)`, func() { version := "2024-06-23" - getInstanceDiskPath := "/instances/testString/disks/testString" + getInstanceClusterNetworkAttachmentPath := "/instances/testString/cluster_network_attachments/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceClusterNetworkAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -23333,10 +24062,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}`) + fmt.Fprintf(res, "%s", `{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}`) })) }) - It(`Invoke GetInstanceDisk successfully with retries`, func() { + It(`Invoke GetInstanceClusterNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23346,22 +24075,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceDiskOptions model - getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) - getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceDiskOptionsModel.ID = core.StringPtr("testString") - getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceClusterNetworkAttachmentOptions model + getInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceClusterNetworkAttachmentOptions) + getInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceDiskWithContext(ctx, getInstanceDiskOptionsModel) + _, _, operationErr := vpcService.GetInstanceClusterNetworkAttachmentWithContext(ctx, getInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) + result, response, operationErr := vpcService.GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23369,7 +24098,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceDiskWithContext(ctx, getInstanceDiskOptionsModel) + _, _, operationErr = vpcService.GetInstanceClusterNetworkAttachmentWithContext(ctx, getInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23383,7 +24112,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceClusterNetworkAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -23391,10 +24120,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}`) + fmt.Fprintf(res, "%s", `{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}`) })) }) - It(`Invoke GetInstanceDisk successfully`, func() { + It(`Invoke GetInstanceClusterNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23404,25 +24133,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceDisk(nil) + result, response, operationErr := vpcService.GetInstanceClusterNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceDiskOptions model - getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) - getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceDiskOptionsModel.ID = core.StringPtr("testString") - getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceClusterNetworkAttachmentOptions model + getInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceClusterNetworkAttachmentOptions) + getInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) + result, response, operationErr = vpcService.GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceDisk with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceClusterNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23431,23 +24160,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceDiskOptions model - getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) - getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceDiskOptionsModel.ID = core.StringPtr("testString") - getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceClusterNetworkAttachmentOptions model + getInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceClusterNetworkAttachmentOptions) + getInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) + result, response, operationErr := vpcService.GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceDiskOptions model with no property values - getInstanceDiskOptionsModelNew := new(vpcv1.GetInstanceDiskOptions) + // Construct a second instance of the GetInstanceClusterNetworkAttachmentOptions model with no property values + getInstanceClusterNetworkAttachmentOptionsModelNew := new(vpcv1.GetInstanceClusterNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23465,7 +24194,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceDisk successfully`, func() { + It(`Invoke GetInstanceClusterNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23474,14 +24203,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceDiskOptions model - getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) - getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceDiskOptionsModel.ID = core.StringPtr("testString") - getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceClusterNetworkAttachmentOptions model + getInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceClusterNetworkAttachmentOptions) + getInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) + result, response, operationErr := vpcService.GetInstanceClusterNetworkAttachment(getInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -23493,16 +24222,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) - Operation response error`, func() { + Describe(`UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptions *UpdateInstanceClusterNetworkAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceDiskPath := "/instances/testString/disks/testString" + updateInstanceClusterNetworkAttachmentPath := "/instances/testString/cluster_network_attachments/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceClusterNetworkAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -23511,7 +24240,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceDisk with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceClusterNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23520,27 +24249,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceDiskPatch model - instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) - instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") - instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() + // Construct an instance of the InstanceClusterNetworkAttachmentPatch model + instanceClusterNetworkAttachmentPatchModel := new(vpcv1.InstanceClusterNetworkAttachmentPatch) + instanceClusterNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceClusterNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceClusterNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceDiskOptions model - updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) - updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch - updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceClusterNetworkAttachmentOptions model + updateInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceClusterNetworkAttachmentOptions) + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceClusterNetworkAttachmentPatch = instanceClusterNetworkAttachmentPatchModelAsPatch + updateInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -23550,16 +24279,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions)`, func() { + Describe(`UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptions *UpdateInstanceClusterNetworkAttachmentOptions)`, func() { version := "2024-06-23" - updateInstanceDiskPath := "/instances/testString/disks/testString" + updateInstanceClusterNetworkAttachmentPath := "/instances/testString/cluster_network_attachments/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceClusterNetworkAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -23586,10 +24315,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}`) + fmt.Fprintf(res, "%s", `{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}`) })) }) - It(`Invoke UpdateInstanceDisk successfully with retries`, func() { + It(`Invoke UpdateInstanceClusterNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23599,29 +24328,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceDiskPatch model - instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) - instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") - instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() + // Construct an instance of the InstanceClusterNetworkAttachmentPatch model + instanceClusterNetworkAttachmentPatchModel := new(vpcv1.InstanceClusterNetworkAttachmentPatch) + instanceClusterNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceClusterNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceClusterNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceDiskOptions model - updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) - updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch - updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceClusterNetworkAttachmentOptions model + updateInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceClusterNetworkAttachmentOptions) + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceClusterNetworkAttachmentPatch = instanceClusterNetworkAttachmentPatchModelAsPatch + updateInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceDiskWithContext(ctx, updateInstanceDiskOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceClusterNetworkAttachmentWithContext(ctx, updateInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23629,7 +24358,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceDiskWithContext(ctx, updateInstanceDiskOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceClusterNetworkAttachmentWithContext(ctx, updateInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23643,7 +24372,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceClusterNetworkAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -23667,10 +24396,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}`) + fmt.Fprintf(res, "%s", `{"before": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "cluster_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}`) })) }) - It(`Invoke UpdateInstanceDisk successfully`, func() { + It(`Invoke UpdateInstanceClusterNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23680,32 +24409,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceDisk(nil) + result, response, operationErr := vpcService.UpdateInstanceClusterNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceDiskPatch model - instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) - instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") - instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() + // Construct an instance of the InstanceClusterNetworkAttachmentPatch model + instanceClusterNetworkAttachmentPatchModel := new(vpcv1.InstanceClusterNetworkAttachmentPatch) + instanceClusterNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceClusterNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceClusterNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceDiskOptions model - updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) - updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch - updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceClusterNetworkAttachmentOptions model + updateInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceClusterNetworkAttachmentOptions) + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceClusterNetworkAttachmentPatch = instanceClusterNetworkAttachmentPatchModelAsPatch + updateInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceDisk with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceClusterNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23714,30 +24443,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceDiskPatch model - instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) - instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") - instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() + // Construct an instance of the InstanceClusterNetworkAttachmentPatch model + instanceClusterNetworkAttachmentPatchModel := new(vpcv1.InstanceClusterNetworkAttachmentPatch) + instanceClusterNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceClusterNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceClusterNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceDiskOptions model - updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) - updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch - updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceClusterNetworkAttachmentOptions model + updateInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceClusterNetworkAttachmentOptions) + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceClusterNetworkAttachmentPatch = instanceClusterNetworkAttachmentPatchModelAsPatch + updateInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceDiskOptions model with no property values - updateInstanceDiskOptionsModelNew := new(vpcv1.UpdateInstanceDiskOptions) + // Construct a second instance of the UpdateInstanceClusterNetworkAttachmentOptions model with no property values + updateInstanceClusterNetworkAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceClusterNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23755,7 +24484,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceDisk successfully`, func() { + It(`Invoke UpdateInstanceClusterNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23764,21 +24493,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceDiskPatch model - instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) - instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") - instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() + // Construct an instance of the InstanceClusterNetworkAttachmentPatch model + instanceClusterNetworkAttachmentPatchModel := new(vpcv1.InstanceClusterNetworkAttachmentPatch) + instanceClusterNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceClusterNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceClusterNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceDiskOptions model - updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) - updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") - updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch - updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceClusterNetworkAttachmentOptions model + updateInstanceClusterNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceClusterNetworkAttachmentOptions) + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.InstanceClusterNetworkAttachmentPatch = instanceClusterNetworkAttachmentPatchModelAsPatch + updateInstanceClusterNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceClusterNetworkAttachment(updateInstanceClusterNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -23790,17 +24519,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) - Operation response error`, func() { + Describe(`CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceNetworkAttachmentsPath := "/instances/testString/network_attachments" + createInstanceConsoleAccessTokenPath := "/instances/testString/console_access_token" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceConsoleAccessTokenPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -23808,7 +24537,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceNetworkAttachments with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceConsoleAccessToken with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23817,19 +24546,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkAttachmentsOptions model - listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) - listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model + createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) + createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) + result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) + result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -23839,17 +24570,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions)`, func() { + Describe(`CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions)`, func() { version := "2024-06-23" - listInstanceNetworkAttachmentsPath := "/instances/testString/network_attachments" + createInstanceConsoleAccessTokenPath := "/instances/testString/console_access_token" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceConsoleAccessTokenPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -23859,10 +24606,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}`) + fmt.Fprintf(res, "%s", `{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}`) })) }) - It(`Invoke ListInstanceNetworkAttachments successfully with retries`, func() { + It(`Invoke CreateInstanceConsoleAccessToken successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23872,21 +24619,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceNetworkAttachmentsOptions model - listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) - listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model + createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) + createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceNetworkAttachmentsWithContext(ctx, listInstanceNetworkAttachmentsOptionsModel) + _, _, operationErr := vpcService.CreateInstanceConsoleAccessTokenWithContext(ctx, createInstanceConsoleAccessTokenOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) + result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23894,7 +24643,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceNetworkAttachmentsWithContext(ctx, listInstanceNetworkAttachmentsOptionsModel) + _, _, operationErr = vpcService.CreateInstanceConsoleAccessTokenWithContext(ctx, createInstanceConsoleAccessTokenOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23908,18 +24657,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceConsoleAccessTokenPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}`) + fmt.Fprintf(res, "%s", `{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}`) })) }) - It(`Invoke ListInstanceNetworkAttachments successfully`, func() { + It(`Invoke CreateInstanceConsoleAccessToken successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23929,24 +24694,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceNetworkAttachments(nil) + result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceNetworkAttachmentsOptions model - listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) - listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model + createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) + createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) + result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceNetworkAttachments with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceConsoleAccessToken with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23955,22 +24722,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkAttachmentsOptions model - listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) - listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model + createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) + createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) + result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceNetworkAttachmentsOptions model with no property values - listInstanceNetworkAttachmentsOptionsModelNew := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + // Construct a second instance of the CreateInstanceConsoleAccessTokenOptions model with no property values + createInstanceConsoleAccessTokenOptionsModelNew := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23988,7 +24757,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceNetworkAttachments successfully`, func() { + It(`Invoke CreateInstanceConsoleAccessToken successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23997,13 +24766,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkAttachmentsOptions model - listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) - listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model + createInstanceConsoleAccessTokenOptionsModel := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) + createInstanceConsoleAccessTokenOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createInstanceConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createInstanceConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) + result, response, operationErr := vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24015,25 +24786,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) - Operation response error`, func() { + Describe(`ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) - Operation response error`, func() { version := "2024-06-23" - createInstanceNetworkAttachmentPath := "/instances/testString/network_attachments" + listInstanceDisksPath := "/instances/testString/disks" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceDisksPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceNetworkAttachment with error: Operation response processing error`, func() { + It(`Invoke ListInstanceDisks with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24042,58 +24813,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the CreateInstanceNetworkAttachmentOptions model - createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) - createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceDisksOptions model + listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) + listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24103,33 +24835,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions)`, func() { + Describe(`ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions)`, func() { version := "2024-06-23" - createInstanceNetworkAttachmentPath := "/instances/testString/network_attachments" + listInstanceDisksPath := "/instances/testString/disks" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceDisksPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -24138,11 +24854,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}]}`) })) }) - It(`Invoke CreateInstanceNetworkAttachment successfully with retries`, func() { + It(`Invoke ListInstanceDisks successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24152,68 +24868,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the ListInstanceDisksOptions model + listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) + listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListInstanceDisksWithContext(ctx, listInstanceDisksOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the CreateInstanceNetworkAttachmentOptions model - createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) - createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := vpcService.CreateInstanceNetworkAttachmentWithContext(ctx, createInstanceNetworkAttachmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceNetworkAttachmentWithContext(ctx, createInstanceNetworkAttachmentOptionsModel) + _, _, operationErr = vpcService.ListInstanceDisksWithContext(ctx, listInstanceDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24227,34 +24904,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceDisksPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}]}`) })) }) - It(`Invoke CreateInstanceNetworkAttachment successfully`, func() { + It(`Invoke ListInstanceDisks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24264,63 +24925,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(nil) + result, response, operationErr := vpcService.ListInstanceDisks(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the CreateInstanceNetworkAttachmentOptions model - createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) - createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceDisksOptions model + listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) + listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceNetworkAttachment with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceDisks with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24329,61 +24951,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the CreateInstanceNetworkAttachmentOptions model - createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) - createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceDisksOptions model + listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) + listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateInstanceNetworkAttachmentOptions model with no property values - createInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + // Construct a second instance of the ListInstanceDisksOptions model with no property values + listInstanceDisksOptionsModelNew := new(vpcv1.ListInstanceDisksOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24398,10 +24981,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateInstanceNetworkAttachment successfully`, func() { + It(`Invoke ListInstanceDisks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24410,52 +24993,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the CreateInstanceNetworkAttachmentOptions model - createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) - createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") - createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceDisksOptions model + listInstanceDisksOptionsModel := new(vpcv1.ListInstanceDisksOptions) + listInstanceDisksOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24467,91 +25011,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions)`, func() { - version := "2024-06-23" - deleteInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceNetworkAttachmentPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteInstanceNetworkAttachment successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceNetworkAttachment(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceNetworkAttachmentOptions model - deleteInstanceNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) - deleteInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - deleteInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceNetworkAttachment with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the DeleteInstanceNetworkAttachmentOptions model - deleteInstanceNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) - deleteInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - deleteInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceNetworkAttachmentOptions model with no property values - deleteInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) - Operation response error`, func() { + Describe(`GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" + getInstanceDiskPath := "/instances/testString/disks/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceDiskPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -24560,7 +25029,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceNetworkAttachment with error: Operation response processing error`, func() { + It(`Invoke GetInstanceDisk with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24569,20 +25038,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkAttachmentOptions model - getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) - getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceDiskOptions model + getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) + getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceDiskOptionsModel.ID = core.StringPtr("testString") + getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24592,16 +25061,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions)`, func() { + Describe(`GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions)`, func() { version := "2024-06-23" - getInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" + getInstanceDiskPath := "/instances/testString/disks/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceDiskPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -24612,10 +25081,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}`) })) }) - It(`Invoke GetInstanceNetworkAttachment successfully with retries`, func() { + It(`Invoke GetInstanceDisk successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24625,22 +25094,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceNetworkAttachmentOptions model - getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) - getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceDiskOptions model + getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) + getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceDiskOptionsModel.ID = core.StringPtr("testString") + getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceNetworkAttachmentWithContext(ctx, getInstanceNetworkAttachmentOptionsModel) + _, _, operationErr := vpcService.GetInstanceDiskWithContext(ctx, getInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24648,7 +25117,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceNetworkAttachmentWithContext(ctx, getInstanceNetworkAttachmentOptionsModel) + _, _, operationErr = vpcService.GetInstanceDiskWithContext(ctx, getInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24662,7 +25131,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceDiskPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -24670,10 +25139,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}`) })) }) - It(`Invoke GetInstanceNetworkAttachment successfully`, func() { + It(`Invoke GetInstanceDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24683,25 +25152,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceNetworkAttachment(nil) + result, response, operationErr := vpcService.GetInstanceDisk(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceNetworkAttachmentOptions model - getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) - getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceDiskOptions model + getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) + getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceDiskOptionsModel.ID = core.StringPtr("testString") + getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceNetworkAttachment with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceDisk with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24710,23 +25179,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkAttachmentOptions model - getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) - getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceDiskOptions model + getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) + getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceDiskOptionsModel.ID = core.StringPtr("testString") + getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceNetworkAttachmentOptions model with no property values - getInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.GetInstanceNetworkAttachmentOptions) + // Construct a second instance of the GetInstanceDiskOptions model with no property values + getInstanceDiskOptionsModelNew := new(vpcv1.GetInstanceDiskOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24744,7 +25213,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceNetworkAttachment successfully`, func() { + It(`Invoke GetInstanceDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24753,14 +25222,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkAttachmentOptions model - getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) - getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceDiskOptions model + getInstanceDiskOptionsModel := new(vpcv1.GetInstanceDiskOptions) + getInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceDiskOptionsModel.ID = core.StringPtr("testString") + getInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24772,16 +25241,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) - Operation response error`, func() { + Describe(`UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" + updateInstanceDiskPath := "/instances/testString/disks/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceDiskPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -24790,7 +25259,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceNetworkAttachment with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceDisk with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24799,27 +25268,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceNetworkAttachmentPatch model - instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) - instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") - instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() + // Construct an instance of the InstanceDiskPatch model + instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) + instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") + instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model - updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) - updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch - updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceDiskOptions model + updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) + updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch + updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24829,16 +25298,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions)`, func() { + Describe(`UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions)`, func() { version := "2024-06-23" - updateInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" + updateInstanceDiskPath := "/instances/testString/disks/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceDiskPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -24865,10 +25334,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}`) })) }) - It(`Invoke UpdateInstanceNetworkAttachment successfully with retries`, func() { + It(`Invoke UpdateInstanceDisk successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24878,29 +25347,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceNetworkAttachmentPatch model - instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) - instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") - instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() + // Construct an instance of the InstanceDiskPatch model + instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) + instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") + instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model - updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) - updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch - updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceDiskOptions model + updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) + updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch + updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceNetworkAttachmentWithContext(ctx, updateInstanceNetworkAttachmentOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceDiskWithContext(ctx, updateInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24908,7 +25377,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceNetworkAttachmentWithContext(ctx, updateInstanceNetworkAttachmentOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceDiskWithContext(ctx, updateInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24922,7 +25391,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceDiskPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -24946,10 +25415,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}`) })) }) - It(`Invoke UpdateInstanceNetworkAttachment successfully`, func() { + It(`Invoke UpdateInstanceDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24959,32 +25428,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(nil) + result, response, operationErr := vpcService.UpdateInstanceDisk(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceNetworkAttachmentPatch model - instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) - instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") - instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() + // Construct an instance of the InstanceDiskPatch model + instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) + instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") + instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model - updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) - updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch - updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceDiskOptions model + updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) + updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch + updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceNetworkAttachment with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceDisk with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24993,30 +25462,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceNetworkAttachmentPatch model - instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) - instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") - instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() + // Construct an instance of the InstanceDiskPatch model + instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) + instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") + instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model - updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) - updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch - updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceDiskOptions model + updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) + updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch + updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceNetworkAttachmentOptions model with no property values - updateInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + // Construct a second instance of the UpdateInstanceDiskOptions model with no property values + updateInstanceDiskOptionsModelNew := new(vpcv1.UpdateInstanceDiskOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25034,7 +25503,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceNetworkAttachment successfully`, func() { + It(`Invoke UpdateInstanceDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25043,21 +25512,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceNetworkAttachmentPatch model - instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) - instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") - instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() + // Construct an instance of the InstanceDiskPatch model + instanceDiskPatchModel := new(vpcv1.InstanceDiskPatch) + instanceDiskPatchModel.Name = core.StringPtr("my-instance-disk-updated") + instanceDiskPatchModelAsPatch, asPatchErr := instanceDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model - updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) - updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch - updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceDiskOptions model + updateInstanceDiskOptionsModel := new(vpcv1.UpdateInstanceDiskOptions) + updateInstanceDiskOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.ID = core.StringPtr("testString") + updateInstanceDiskOptionsModel.InstanceDiskPatch = instanceDiskPatchModelAsPatch + updateInstanceDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25069,16 +25538,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) - Operation response error`, func() { + Describe(`ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceNetworkInterfacesPath := "/instances/testString/network_interfaces" + listInstanceNetworkAttachmentsPath := "/instances/testString/network_attachments" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -25087,7 +25556,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceNetworkInterfaces with error: Operation response processing error`, func() { + It(`Invoke ListInstanceNetworkAttachments with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25096,19 +25565,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25118,16 +25587,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions)`, func() { + Describe(`ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions)`, func() { version := "2024-06-23" - listInstanceNetworkInterfacesPath := "/instances/testString/network_interfaces" + listInstanceNetworkAttachmentsPath := "/instances/testString/network_attachments" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -25138,10 +25607,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}`) + fmt.Fprintf(res, "%s", `{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}`) })) }) - It(`Invoke ListInstanceNetworkInterfaces successfully with retries`, func() { + It(`Invoke ListInstanceNetworkAttachments successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25151,21 +25620,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) + _, _, operationErr := vpcService.ListInstanceNetworkAttachmentsWithContext(ctx, listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25173,7 +25642,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) + _, _, operationErr = vpcService.ListInstanceNetworkAttachmentsWithContext(ctx, listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25187,7 +25656,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -25195,10 +25664,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}`) + fmt.Fprintf(res, "%s", `{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}`) })) }) - It(`Invoke ListInstanceNetworkInterfaces successfully`, func() { + It(`Invoke ListInstanceNetworkAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25208,24 +25677,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(nil) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceNetworkInterfaces with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceNetworkAttachments with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25234,22 +25703,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceNetworkInterfacesOptions model with no property values - listInstanceNetworkInterfacesOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfacesOptions) + // Construct a second instance of the ListInstanceNetworkAttachmentsOptions model with no property values + listInstanceNetworkAttachmentsOptionsModelNew := new(vpcv1.ListInstanceNetworkAttachmentsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25267,7 +25736,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceNetworkInterfaces successfully`, func() { + It(`Invoke ListInstanceNetworkAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25276,13 +25745,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25294,16 +25763,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - createInstanceNetworkInterfacePath := "/instances/testString/network_interfaces" + createInstanceNetworkAttachmentPath := "/instances/testString/network_attachments" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -25312,7 +25781,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25321,38 +25790,58 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25362,16 +25851,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions)`, func() { + Describe(`CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions)`, func() { version := "2024-06-23" - createInstanceNetworkInterfacePath := "/instances/testString/network_interfaces" + createInstanceNetworkAttachmentPath := "/instances/testString/network_attachments" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -25398,10 +25887,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke CreateInstanceNetworkInterface successfully with retries`, func() { + It(`Invoke CreateInstanceNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25411,40 +25900,60 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.CreateInstanceNetworkAttachmentWithContext(ctx, createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25452,7 +25961,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.CreateInstanceNetworkAttachmentWithContext(ctx, createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25466,7 +25975,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -25490,10 +25999,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke CreateInstanceNetworkInterface successfully`, func() { + It(`Invoke CreateInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25503,43 +26012,63 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceNetworkInterface(nil) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25548,41 +26077,61 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateInstanceNetworkInterfaceOptions model with no property values - createInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + // Construct a second instance of the CreateInstanceNetworkAttachmentOptions model with no property values + createInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.CreateInstanceNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25600,7 +26149,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceNetworkInterface successfully`, func() { + It(`Invoke CreateInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25609,32 +26158,52 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25646,24 +26215,24 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions)`, func() { + Describe(`DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions)`, func() { version := "2024-06-23" - deleteInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + deleteInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.WriteHeader(202) })) }) - It(`Invoke DeleteInstanceNetworkInterface successfully`, func() { + It(`Invoke DeleteInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25673,22 +26242,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceNetworkInterface(nil) + response, operationErr := vpcService.DeleteInstanceNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model - deleteInstanceNetworkInterfaceOptionsModel := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) - deleteInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - deleteInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceNetworkAttachmentOptions model + deleteInstanceNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) + deleteInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModel) + response, operationErr = vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25697,22 +26266,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model - deleteInstanceNetworkInterfaceOptionsModel := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) - deleteInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - deleteInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceNetworkAttachmentOptions model + deleteInstanceNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) + deleteInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModel) + response, operationErr := vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceNetworkInterfaceOptions model with no property values - deleteInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) + // Construct a second instance of the DeleteInstanceNetworkAttachmentOptions model with no property values + deleteInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -25721,16 +26290,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + getInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -25739,7 +26308,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke GetInstanceNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25748,20 +26317,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25771,16 +26340,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions)`, func() { + Describe(`GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions)`, func() { version := "2024-06-23" - getInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + getInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -25791,10 +26360,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke GetInstanceNetworkInterface successfully with retries`, func() { + It(`Invoke GetInstanceNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25804,22 +26373,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.GetInstanceNetworkAttachmentWithContext(ctx, getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25827,7 +26396,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.GetInstanceNetworkAttachmentWithContext(ctx, getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25841,7 +26410,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -25849,10 +26418,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke GetInstanceNetworkInterface successfully`, func() { + It(`Invoke GetInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25862,25 +26431,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceNetworkInterface(nil) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25889,23 +26458,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceNetworkInterfaceOptions model with no property values - getInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceOptions) + // Construct a second instance of the GetInstanceNetworkAttachmentOptions model with no property values + getInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.GetInstanceNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25923,7 +26492,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceNetworkInterface successfully`, func() { + It(`Invoke GetInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25932,14 +26501,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25951,16 +26520,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + updateInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -25969,7 +26538,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25978,28 +26547,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26009,16 +26577,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions)`, func() { + Describe(`UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions)`, func() { version := "2024-06-23" - updateInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + updateInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -26045,10 +26613,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke UpdateInstanceNetworkInterface successfully with retries`, func() { + It(`Invoke UpdateInstanceNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26058,30 +26626,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceNetworkAttachmentWithContext(ctx, updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26089,7 +26656,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceNetworkAttachmentWithContext(ctx, updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26103,7 +26670,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -26127,10 +26694,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "instance_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke UpdateInstanceNetworkInterface successfully`, func() { + It(`Invoke UpdateInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26140,33 +26707,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(nil) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26175,31 +26741,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceNetworkInterfaceOptions model with no property values - updateInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + // Construct a second instance of the UpdateInstanceNetworkAttachmentOptions model with no property values + updateInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26217,7 +26782,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceNetworkInterface successfully`, func() { + It(`Invoke UpdateInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26226,22 +26791,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26253,16 +26817,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { + Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceNetworkInterfaceFloatingIpsPath := "/instances/testString/network_interfaces/testString/floating_ips" + listInstanceNetworkInterfacesPath := "/instances/testString/network_interfaces" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -26271,7 +26835,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { + It(`Invoke ListInstanceNetworkInterfaces with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26280,20 +26844,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26303,16 +26866,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions)`, func() { + Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions)`, func() { version := "2024-06-23" - listInstanceNetworkInterfaceFloatingIpsPath := "/instances/testString/network_interfaces/testString/floating_ips" + listInstanceNetworkInterfacesPath := "/instances/testString/network_interfaces" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -26323,10 +26886,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}`) })) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully with retries`, func() { + It(`Invoke ListInstanceNetworkInterfaces successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26336,22 +26899,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr := vpcService.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26359,7 +26921,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr = vpcService.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26373,7 +26935,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -26381,10 +26943,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}`) })) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26394,25 +26956,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(nil) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceNetworkInterfaces with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26421,23 +26982,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model with no property values - listInstanceNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + // Construct a second instance of the ListInstanceNetworkInterfacesOptions model with no property values + listInstanceNetworkInterfacesOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfacesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26455,7 +27015,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26464,14 +27024,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26483,102 +27042,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions)`, func() { - version := "2024-06-23" - removeInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(removeInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke RemoveInstanceNetworkInterfaceFloatingIP successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.RemoveInstanceNetworkInterfaceFloatingIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model - removeInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) - removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke RemoveInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model - removeInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) - removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model with no property values - removeInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" + createInstanceNetworkInterfacePath := "/instances/testString/network_interfaces" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26587,21 +27069,38 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26611,17 +27110,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions)`, func() { version := "2024-06-23" - getInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" + createInstanceNetworkInterfacePath := "/instances/testString/network_interfaces" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -26630,11 +27145,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) })) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke CreateInstanceNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26644,23 +27159,40 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26668,7 +27200,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26682,18 +27214,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) })) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke CreateInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26703,26 +27251,43 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26731,24 +27296,41 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceNetworkInterfaceFloatingIPOptions model with no property values - getInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the CreateInstanceNetworkInterfaceOptions model with no property values + createInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.CreateInstanceNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26763,10 +27345,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke CreateInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26775,15 +27357,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26795,25 +27394,100 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions)`, func() { version := "2024-06-23" - addInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" + deleteInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceNetworkInterface successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteInstanceNetworkInterface(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model + deleteInstanceNetworkInterfaceOptionsModel := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) + deleteInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceNetworkInterface with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model + deleteInstanceNetworkInterfaceOptionsModel := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) + deleteInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceNetworkInterfaceOptions model with no property values + deleteInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) - Operation response error`, func() { + version := "2024-06-23" + getInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke GetInstanceNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26822,21 +27496,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26846,17 +27519,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions)`, func() { version := "2024-06-23" - addInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" + getInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -26865,11 +27538,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) })) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke GetInstanceNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26879,23 +27552,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26903,7 +27575,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26917,18 +27589,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) })) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke GetInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26938,26 +27610,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26966,24 +27637,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the AddInstanceNetworkInterfaceFloatingIPOptions model with no property values - addInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the GetInstanceNetworkInterfaceOptions model with no property values + getInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26998,10 +27668,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke GetInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27010,15 +27680,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27030,27 +27699,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) - Operation response error`, func() { + Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceNetworkInterfaceIpsPath := "/instances/testString/network_interfaces/testString/ips" + updateInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceNetworkInterfaceIps with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27059,22 +27726,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-updated") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27084,32 +27757,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions)`, func() { + Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions)`, func() { version := "2024-06-23" - listInstanceNetworkInterfaceIpsPath := "/instances/testString/network_interfaces/testString/ips" + updateInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) })) }) - It(`Invoke ListInstanceNetworkInterfaceIps successfully with retries`, func() { + It(`Invoke UpdateInstanceNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27119,24 +27806,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-updated") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27144,7 +27837,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27158,20 +27851,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) })) }) - It(`Invoke ListInstanceNetworkInterfaceIps successfully`, func() { + It(`Invoke UpdateInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27181,27 +27888,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(nil) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-updated") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceNetworkInterfaceIps with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27210,25 +27923,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-updated") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceNetworkInterfaceIpsOptions model with no property values - listInstanceNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + // Construct a second instance of the UpdateInstanceNetworkInterfaceOptions model with no property values + updateInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -27246,7 +27965,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceNetworkInterfaceIps successfully`, func() { + It(`Invoke UpdateInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27255,16 +27974,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-updated") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27275,122 +28000,17 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContext) - nextObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContextNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContext) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContext) - nextObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContextNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"ips":[{"address":"192.168.3.4","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"ips":[{"address":"192.168.3.4","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use InstanceNetworkInterfaceIpsPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listInstanceNetworkInterfaceIpsOptionsModel := &vpcv1.ListInstanceNetworkInterfaceIpsOptions{ - InstanceID: core.StringPtr("testString"), - NetworkInterfaceID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceNetworkInterfaceIpsPager(listInstanceNetworkInterfaceIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.ReservedIP - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use InstanceNetworkInterfaceIpsPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listInstanceNetworkInterfaceIpsOptionsModel := &vpcv1.ListInstanceNetworkInterfaceIpsOptions{ - InstanceID: core.StringPtr("testString"), - NetworkInterfaceID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceNetworkInterfaceIpsPager(listInstanceNetworkInterfaceIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) - }) - Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) - Operation response error`, func() { - version := "2024-06-23" - getInstanceNetworkInterfaceIPPath := "/instances/testString/network_interfaces/testString/ips/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + }) + Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { + version := "2024-06-23" + listInstanceNetworkInterfaceFloatingIpsPath := "/instances/testString/network_interfaces/testString/floating_ips" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -27399,7 +28019,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceNetworkInterfaceIP with error: Operation response processing error`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27408,21 +28028,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27432,16 +28051,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions)`, func() { + Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions)`, func() { version := "2024-06-23" - getInstanceNetworkInterfaceIPPath := "/instances/testString/network_interfaces/testString/ips/testString" + listInstanceNetworkInterfaceFloatingIpsPath := "/instances/testString/network_interfaces/testString/floating_ips" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -27452,10 +28071,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke GetInstanceNetworkInterfaceIP successfully with retries`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27465,23 +28084,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) + _, _, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27489,7 +28107,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) + _, _, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27503,7 +28121,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -27511,10 +28129,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke GetInstanceNetworkInterfaceIP successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27524,26 +28142,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(nil) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceNetworkInterfaceIP with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27552,24 +28169,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceNetworkInterfaceIPOptions model with no property values - getInstanceNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + // Construct a second instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model with no property values + listInstanceNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -27587,7 +28203,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceNetworkInterfaceIP successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27596,15 +28212,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27616,16 +28231,93 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) - Operation response error`, func() { + Describe(`RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions)`, func() { version := "2024-06-23" - listInstanceVolumeAttachmentsPath := "/instances/testString/volume_attachments" + removeInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(removeInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke RemoveInstanceNetworkInterfaceFloatingIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.RemoveInstanceNetworkInterfaceFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model + removeInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) + removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model + removeInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) + removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model with no property values + removeInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + version := "2024-06-23" + getInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -27634,7 +28326,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceVolumeAttachments with error: Operation response processing error`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27643,19 +28335,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27665,16 +28359,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions)`, func() { + Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions)`, func() { version := "2024-06-23" - listInstanceVolumeAttachmentsPath := "/instances/testString/volume_attachments" + getInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -27685,10 +28379,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListInstanceVolumeAttachments successfully with retries`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27698,21 +28392,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) + _, _, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27720,7 +28416,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) + _, _, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27734,7 +28430,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -27742,10 +28438,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListInstanceVolumeAttachments successfully`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27755,24 +28451,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceVolumeAttachments(nil) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceVolumeAttachments with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27781,22 +28479,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceVolumeAttachmentsOptions model with no property values - listInstanceVolumeAttachmentsOptionsModelNew := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + // Construct a second instance of the GetInstanceNetworkInterfaceFloatingIPOptions model with no property values + getInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -27814,7 +28514,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceVolumeAttachments successfully`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27823,13 +28523,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27841,17 +28543,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) - Operation response error`, func() { + Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { version := "2024-06-23" - createInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments" + addInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -27859,7 +28561,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceVolumeAttachment with error: Operation response processing error`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27868,26 +28570,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27897,33 +28594,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions)`, func() { + Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions)`, func() { version := "2024-06-23" - createInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments" + addInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -27933,10 +28614,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateInstanceVolumeAttachment successfully with retries`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27946,28 +28627,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) + _, _, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27975,7 +28651,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) + _, _, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27989,34 +28665,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateInstanceVolumeAttachment successfully`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28026,31 +28686,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(nil) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceVolumeAttachment with error: Operation validation and request error`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28059,29 +28714,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateInstanceVolumeAttachmentOptions model with no property values - createInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + // Construct a second instance of the AddInstanceNetworkInterfaceFloatingIPOptions model with no property values + addInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModelNew) + result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -28099,7 +28749,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceVolumeAttachment successfully`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28108,20 +28758,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28133,100 +28778,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions)`, func() { - version := "2024-06-23" - deleteInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstanceVolumeAttachment successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceVolumeAttachment(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model - deleteInstanceVolumeAttachmentOptionsModel := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) - deleteInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - deleteInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceVolumeAttachment with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model - deleteInstanceVolumeAttachmentOptionsModel := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) - deleteInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - deleteInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceVolumeAttachmentOptions model with no property values - deleteInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) - Operation response error`, func() { + Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" + listInstanceNetworkInterfaceIpsPath := "/instances/testString/network_interfaces/testString/ips" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceVolumeAttachment with error: Operation response processing error`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28235,20 +28807,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -28258,30 +28832,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions)`, func() { + Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions)`, func() { version := "2024-06-23" - getInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" + listInstanceNetworkInterfaceIpsPath := "/instances/testString/network_interfaces/testString/ips" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke GetInstanceVolumeAttachment successfully with retries`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28291,22 +28867,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) + _, _, operationErr := vpcService.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28314,7 +28892,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) + _, _, operationErr = vpcService.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28328,18 +28906,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke GetInstanceVolumeAttachment successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28349,25 +28929,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceVolumeAttachment(nil) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceVolumeAttachment with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28376,23 +28958,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceVolumeAttachmentOptions model with no property values - getInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.GetInstanceVolumeAttachmentOptions) + // Construct a second instance of the ListInstanceNetworkInterfaceIpsOptions model with no property values + listInstanceNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -28410,7 +28994,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceVolumeAttachment successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28419,14 +29003,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28437,18 +29023,123 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContext) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContext) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContext) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"ips":[{"address":"192.168.3.4","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"ips":[{"address":"192.168.3.4","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"provider","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use InstanceNetworkInterfaceIpsPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listInstanceNetworkInterfaceIpsOptionsModel := &vpcv1.ListInstanceNetworkInterfaceIpsOptions{ + InstanceID: core.StringPtr("testString"), + NetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceNetworkInterfaceIpsPager(listInstanceNetworkInterfaceIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ReservedIP + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use InstanceNetworkInterfaceIpsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listInstanceNetworkInterfaceIpsOptionsModel := &vpcv1.ListInstanceNetworkInterfaceIpsOptions{ + InstanceID: core.StringPtr("testString"), + NetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceNetworkInterfaceIpsPager(listInstanceNetworkInterfaceIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) - Operation response error`, func() { + Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" + getInstanceNetworkInterfaceIPPath := "/instances/testString/network_interfaces/testString/ips/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -28456,7 +29147,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceVolumeAttachment with error: Operation response processing error`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28465,28 +29156,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -28496,33 +29180,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions)`, func() { + Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions)`, func() { version := "2024-06-23" - updateInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" + getInstanceNetworkInterfaceIPPath := "/instances/testString/network_interfaces/testString/ips/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -28532,10 +29200,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) })) }) - It(`Invoke UpdateInstanceVolumeAttachment successfully with retries`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28545,30 +29213,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) + _, _, operationErr := vpcService.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28576,7 +29237,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) + _, _, operationErr = vpcService.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28590,34 +29251,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) })) }) - It(`Invoke UpdateInstanceVolumeAttachment successfully`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28627,33 +29272,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(nil) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceVolumeAttachment with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28662,31 +29300,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceVolumeAttachmentOptions model with no property values - updateInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + // Construct a second instance of the GetInstanceNetworkInterfaceIPOptions model with no property values + getInstanceNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -28704,7 +29335,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceVolumeAttachment successfully`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28713,22 +29344,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28740,27 +29364,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) - Operation response error`, func() { + Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceGroupsPath := "/instance_groups" + listInstanceVolumeAttachmentsPath := "/instances/testString/volume_attachments" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroups with error: Operation response processing error`, func() { + It(`Invoke ListInstanceVolumeAttachments with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28769,20 +29391,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -28792,32 +29413,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions)`, func() { + Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions)`, func() { version := "2024-06-23" - listInstanceGroupsPath := "/instance_groups" + listInstanceVolumeAttachmentsPath := "/instances/testString/volume_attachments" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?limit=20"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}`) })) }) - It(`Invoke ListInstanceGroups successfully with retries`, func() { + It(`Invoke ListInstanceVolumeAttachments successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28827,22 +29446,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) + _, _, operationErr := vpcService.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28850,7 +29468,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) + _, _, operationErr = vpcService.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28864,20 +29482,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?limit=20"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}`) })) }) - It(`Invoke ListInstanceGroups successfully`, func() { + It(`Invoke ListInstanceVolumeAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28887,25 +29503,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroups(nil) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroups with error: Operation request error`, func() { + It(`Invoke ListInstanceVolumeAttachments with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28914,19 +29529,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ListInstanceVolumeAttachmentsOptions model with no property values + listInstanceVolumeAttachmentsOptionsModelNew := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -28941,7 +29562,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroups successfully`, func() { + It(`Invoke ListInstanceVolumeAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28950,14 +29571,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28968,118 +29588,17 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupCollection) - nextObject := new(vpcv1.InstanceGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.InstanceGroupCollection) - nextObject := new(vpcv1.InstanceGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use InstanceGroupsPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.InstanceGroup - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use InstanceGroupsPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) - Operation response error`, func() { + Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - createInstanceGroupPath := "/instance_groups" + createInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -29088,7 +29607,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroup with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceVolumeAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29097,46 +29616,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29146,16 +29645,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions)`, func() { + Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions)`, func() { version := "2024-06-23" - createInstanceGroupPath := "/instance_groups" + createInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -29182,10 +29681,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke CreateInstanceGroup successfully with retries`, func() { + It(`Invoke CreateInstanceVolumeAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29195,48 +29694,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) + _, _, operationErr := vpcService.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29244,7 +29723,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) + _, _, operationErr = vpcService.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29258,7 +29737,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -29282,10 +29761,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke CreateInstanceGroup successfully`, func() { + It(`Invoke CreateInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29295,51 +29774,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceGroup(nil) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceGroup with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceVolumeAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29348,49 +29807,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateInstanceGroupOptions model with no property values - createInstanceGroupOptionsModelNew := new(vpcv1.CreateInstanceGroupOptions) + // Construct a second instance of the CreateInstanceVolumeAttachmentOptions model with no property values + createInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.CreateInstanceVolumeAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -29408,7 +29847,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceGroup successfully`, func() { + It(`Invoke CreateInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29417,40 +29856,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29462,16 +29881,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions)`, func() { + Describe(`DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions)`, func() { version := "2024-06-23" - deleteInstanceGroupPath := "/instance_groups/testString" + deleteInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -29479,7 +29898,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteInstanceGroup successfully`, func() { + It(`Invoke DeleteInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29489,21 +29908,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroup(nil) + response, operationErr := vpcService.DeleteInstanceVolumeAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceGroupOptions model - deleteInstanceGroupOptionsModel := new(vpcv1.DeleteInstanceGroupOptions) - deleteInstanceGroupOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model + deleteInstanceVolumeAttachmentOptionsModel := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) + deleteInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) + response, operationErr = vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceGroup with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceVolumeAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29512,21 +29932,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceGroupOptions model - deleteInstanceGroupOptionsModel := new(vpcv1.DeleteInstanceGroupOptions) - deleteInstanceGroupOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model + deleteInstanceVolumeAttachmentOptionsModel := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) + deleteInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) + response, operationErr := vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupOptions model with no property values - deleteInstanceGroupOptionsModelNew := new(vpcv1.DeleteInstanceGroupOptions) + // Construct a second instance of the DeleteInstanceVolumeAttachmentOptions model with no property values + deleteInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -29535,16 +29956,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) - Operation response error`, func() { + Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceGroupPath := "/instance_groups/testString" + getInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -29553,7 +29974,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroup with error: Operation response processing error`, func() { + It(`Invoke GetInstanceVolumeAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29562,19 +29983,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29584,16 +30006,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions)`, func() { + Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions)`, func() { version := "2024-06-23" - getInstanceGroupPath := "/instance_groups/testString" + getInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -29604,10 +30026,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke GetInstanceGroup successfully with retries`, func() { + It(`Invoke GetInstanceVolumeAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29617,21 +30039,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) + _, _, operationErr := vpcService.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29639,7 +30062,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) + _, _, operationErr = vpcService.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29653,7 +30076,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -29661,10 +30084,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke GetInstanceGroup successfully`, func() { + It(`Invoke GetInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29674,24 +30097,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroup(nil) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroup with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceVolumeAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29700,22 +30124,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceGroupOptions model with no property values - getInstanceGroupOptionsModelNew := new(vpcv1.GetInstanceGroupOptions) + // Construct a second instance of the GetInstanceVolumeAttachmentOptions model with no property values + getInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.GetInstanceVolumeAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -29733,7 +30158,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroup successfully`, func() { + It(`Invoke GetInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29742,13 +30167,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29760,16 +30186,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) - Operation response error`, func() { + Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceGroupPath := "/instance_groups/testString" + updateInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -29778,7 +30204,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroup with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceVolumeAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29787,48 +30213,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29838,16 +30244,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions)`, func() { + Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions)`, func() { version := "2024-06-23" - updateInstanceGroupPath := "/instance_groups/testString" + updateInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -29874,10 +30280,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke UpdateInstanceGroup successfully with retries`, func() { + It(`Invoke UpdateInstanceVolumeAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29887,50 +30293,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29938,7 +30324,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29952,7 +30338,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -29976,10 +30362,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke UpdateInstanceGroup successfully`, func() { + It(`Invoke UpdateInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29989,53 +30375,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroup(nil) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroup with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceVolumeAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30044,51 +30410,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceGroupOptions model with no property values - updateInstanceGroupOptionsModelNew := new(vpcv1.UpdateInstanceGroupOptions) + // Construct a second instance of the UpdateInstanceVolumeAttachmentOptions model with no property values + updateInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -30106,7 +30452,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroup successfully`, func() { + It(`Invoke UpdateInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30115,42 +30461,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30162,89 +30488,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions)`, func() { - version := "2024-06-23" - deleteInstanceGroupLoadBalancerPath := "/instance_groups/testString/load_balancer" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupLoadBalancerPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstanceGroupLoadBalancer successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupLoadBalancer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model - deleteInstanceGroupLoadBalancerOptionsModel := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) - deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceGroupLoadBalancer with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model - deleteInstanceGroupLoadBalancerOptionsModel := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) - deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupLoadBalancerOptions model with no property values - deleteInstanceGroupLoadBalancerOptionsModelNew := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) - Operation response error`, func() { + Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceGroupManagersPath := "/instance_groups/testString/managers" + listInstanceGroupsPath := "/instance_groups" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -30255,7 +30508,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroupManagers with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroups with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30264,21 +30517,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -30288,16 +30540,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions)`, func() { + Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions)`, func() { version := "2024-06-23" - listInstanceGroupManagersPath := "/instance_groups/testString/managers" + listInstanceGroupsPath := "/instance_groups" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -30310,10 +30562,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?limit=20"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagers successfully with retries`, func() { + It(`Invoke ListInstanceGroups successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30323,23 +30575,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30347,7 +30598,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30361,7 +30612,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -30371,10 +30622,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?limit=20"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagers successfully`, func() { + It(`Invoke ListInstanceGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30384,26 +30635,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroupManagers(nil) + result, response, operationErr := vpcService.ListInstanceGroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroupManagers with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroups with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30412,27 +30662,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceGroupManagersOptions model with no property values - listInstanceGroupManagersOptionsModelNew := new(vpcv1.ListInstanceGroupManagersOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -30447,7 +30689,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroupManagers successfully`, func() { + It(`Invoke ListInstanceGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30456,15 +30698,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30477,8 +30718,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupManagerCollection) - nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) + responseObject := new(vpcv1.InstanceGroupCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -30487,15 +30728,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupManagerCollection) + responseObject := new(vpcv1.InstanceGroupCollection) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.InstanceGroupManagerCollection) - nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) + responseObject := new(vpcv1.InstanceGroupCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -30511,7 +30752,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -30519,15 +30760,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","management_enabled":false,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy"}]}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","management_enabled":false,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy"}]}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"updated_at":"2019-01-01T12:00:00.000Z","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use InstanceGroupManagersPager.GetNext successfully`, func() { + It(`Use InstanceGroupsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30536,16 +30777,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) + pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.InstanceGroupManagerIntf + var allResults []vpcv1.InstanceGroup for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -30554,7 +30794,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use InstanceGroupManagersPager.GetAll successfully`, func() { + It(`Use InstanceGroupsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30563,12 +30803,11 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) + pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -30579,16 +30818,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) - Operation response error`, func() { + Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) - Operation response error`, func() { version := "2024-06-23" - createInstanceGroupManagerPath := "/instance_groups/testString/managers" + createInstanceGroupPath := "/instance_groups" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -30597,7 +30836,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroupManager with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30606,30 +30845,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -30639,16 +30894,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions)`, func() { + Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions)`, func() { version := "2024-06-23" - createInstanceGroupManagerPath := "/instance_groups/testString/managers" + createInstanceGroupPath := "/instance_groups" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -30675,10 +30930,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke CreateInstanceGroupManager successfully with retries`, func() { + It(`Invoke CreateInstanceGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30688,32 +30943,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) + _, _, operationErr := vpcService.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30721,7 +30992,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) + _, _, operationErr = vpcService.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30735,7 +31006,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -30759,10 +31030,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke CreateInstanceGroupManager successfully`, func() { + It(`Invoke CreateInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30772,35 +31043,51 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceGroupManager(nil) + result, response, operationErr := vpcService.CreateInstanceGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceGroupManager with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30809,33 +31096,49 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateInstanceGroupManagerOptions model with no property values - createInstanceGroupManagerOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerOptions) + // Construct a second instance of the CreateInstanceGroupOptions model with no property values + createInstanceGroupOptionsModelNew := new(vpcv1.CreateInstanceGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -30853,7 +31156,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceGroupManager successfully`, func() { + It(`Invoke CreateInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30862,24 +31165,40 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30891,16 +31210,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions)`, func() { + Describe(`DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions)`, func() { version := "2024-06-23" - deleteInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + deleteInstanceGroupPath := "/instance_groups/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -30908,7 +31227,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteInstanceGroupManager successfully`, func() { + It(`Invoke DeleteInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30918,22 +31237,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupManager(nil) + response, operationErr := vpcService.DeleteInstanceGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerOptions model - deleteInstanceGroupManagerOptionsModel := new(vpcv1.DeleteInstanceGroupManagerOptions) - deleteInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupOptions model + deleteInstanceGroupOptionsModel := new(vpcv1.DeleteInstanceGroupOptions) + deleteInstanceGroupOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) + response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceGroupManager with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30942,22 +31260,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerOptions model - deleteInstanceGroupManagerOptionsModel := new(vpcv1.DeleteInstanceGroupManagerOptions) - deleteInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupOptions model + deleteInstanceGroupOptionsModel := new(vpcv1.DeleteInstanceGroupOptions) + deleteInstanceGroupOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) + response, operationErr := vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupManagerOptions model with no property values - deleteInstanceGroupManagerOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerOptions) + // Construct a second instance of the DeleteInstanceGroupOptions model with no property values + deleteInstanceGroupOptionsModelNew := new(vpcv1.DeleteInstanceGroupOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -30966,16 +31283,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) - Operation response error`, func() { + Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + getInstanceGroupPath := "/instance_groups/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -30984,7 +31301,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroupManager with error: Operation response processing error`, func() { + It(`Invoke GetInstanceGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30993,20 +31310,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31016,16 +31332,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions)`, func() { + Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions)`, func() { version := "2024-06-23" - getInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + getInstanceGroupPath := "/instance_groups/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -31036,10 +31352,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke GetInstanceGroupManager successfully with retries`, func() { + It(`Invoke GetInstanceGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31049,22 +31365,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31072,7 +31387,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31086,7 +31401,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -31094,10 +31409,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke GetInstanceGroupManager successfully`, func() { + It(`Invoke GetInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31107,25 +31422,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroupManager(nil) + result, response, operationErr := vpcService.GetInstanceGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroupManager with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31134,23 +31448,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceGroupManagerOptions model with no property values - getInstanceGroupManagerOptionsModelNew := new(vpcv1.GetInstanceGroupManagerOptions) + // Construct a second instance of the GetInstanceGroupOptions model with no property values + getInstanceGroupOptionsModelNew := new(vpcv1.GetInstanceGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31168,7 +31481,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroupManager successfully`, func() { + It(`Invoke GetInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31177,14 +31490,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31196,16 +31508,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + updateInstanceGroupPath := "/instance_groups/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -31214,7 +31526,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroupManager with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31223,32 +31535,48 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31258,16 +31586,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions)`, func() { + Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions)`, func() { version := "2024-06-23" - updateInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + updateInstanceGroupPath := "/instance_groups/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -31294,10 +31622,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke UpdateInstanceGroupManager successfully with retries`, func() { + It(`Invoke UpdateInstanceGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31307,34 +31635,50 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31342,7 +31686,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31356,7 +31700,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -31380,10 +31724,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "updated_at": "2019-01-01T12:00:00.000Z", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke UpdateInstanceGroupManager successfully`, func() { + It(`Invoke UpdateInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31393,37 +31737,53 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroupManager(nil) + result, response, operationErr := vpcService.UpdateInstanceGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroupManager with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31432,35 +31792,51 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceGroupManagerOptions model with no property values - updateInstanceGroupManagerOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerOptions) + // Construct a second instance of the UpdateInstanceGroupOptions model with no property values + updateInstanceGroupOptionsModelNew := new(vpcv1.UpdateInstanceGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31478,7 +31854,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroupManager successfully`, func() { + It(`Invoke UpdateInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31487,26 +31863,42 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31518,16 +31910,89 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) - Operation response error`, func() { + Describe(`DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions)`, func() { version := "2024-06-23" - listInstanceGroupManagerActionsPath := "/instance_groups/testString/managers/testString/actions" + deleteInstanceGroupLoadBalancerPath := "/instance_groups/testString/load_balancer" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupLoadBalancerPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceGroupLoadBalancer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteInstanceGroupLoadBalancer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model + deleteInstanceGroupLoadBalancerOptionsModel := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) + deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceGroupLoadBalancer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model + deleteInstanceGroupLoadBalancerOptionsModel := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) + deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceGroupLoadBalancerOptions model with no property values + deleteInstanceGroupLoadBalancerOptionsModelNew := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) - Operation response error`, func() { + version := "2024-06-23" + listInstanceGroupManagersPath := "/instance_groups/testString/managers" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -31538,7 +32003,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroupManagerActions with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroupManagers with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31547,22 +32012,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31572,16 +32036,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions)`, func() { + Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions)`, func() { version := "2024-06-23" - listInstanceGroupManagerActionsPath := "/instance_groups/testString/managers/testString/actions" + listInstanceGroupManagersPath := "/instance_groups/testString/managers" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -31594,10 +32058,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagerActions successfully with retries`, func() { + It(`Invoke ListInstanceGroupManagers successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31607,24 +32071,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31632,7 +32095,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31646,7 +32109,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -31656,10 +32119,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagerActions successfully`, func() { + It(`Invoke ListInstanceGroupManagers successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31669,27 +32132,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroupManagerActions(nil) + result, response, operationErr := vpcService.ListInstanceGroupManagers(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroupManagerActions with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroupManagers with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31698,25 +32160,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceGroupManagerActionsOptions model with no property values - listInstanceGroupManagerActionsOptionsModelNew := new(vpcv1.ListInstanceGroupManagerActionsOptions) + // Construct a second instance of the ListInstanceGroupManagersOptions model with no property values + listInstanceGroupManagersOptionsModelNew := new(vpcv1.ListInstanceGroupManagersOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31734,7 +32195,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroupManagerActions successfully`, func() { + It(`Invoke ListInstanceGroupManagers successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31743,16 +32204,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31765,8 +32225,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) - nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -31775,15 +32235,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) + responseObject := new(vpcv1.InstanceGroupManagerCollection) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) - nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -31799,7 +32259,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -31807,15 +32267,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","management_enabled":false,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy"}]}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","management_enabled":false,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy"}]}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use InstanceGroupManagerActionsPager.GetNext successfully`, func() { + It(`Use InstanceGroupManagersPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31824,17 +32284,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ - InstanceGroupID: core.StringPtr("testString"), - InstanceGroupManagerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) + pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.InstanceGroupManagerActionIntf + var allResults []vpcv1.InstanceGroupManagerIntf for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -31843,7 +32302,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use InstanceGroupManagerActionsPager.GetAll successfully`, func() { + It(`Use InstanceGroupManagersPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31852,13 +32311,12 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ - InstanceGroupID: core.StringPtr("testString"), - InstanceGroupManagerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) + pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -31869,16 +32327,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) - Operation response error`, func() { + Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) - Operation response error`, func() { version := "2024-06-23" - createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" + createInstanceGroupManagerPath := "/instance_groups/testString/managers" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -31887,7 +32345,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroupManagerAction with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceGroupManager with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31896,31 +32354,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31930,16 +32387,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions)`, func() { + Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions)`, func() { version := "2024-06-23" - createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" + createInstanceGroupManagerPath := "/instance_groups/testString/managers" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -31966,10 +32423,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke CreateInstanceGroupManagerAction successfully with retries`, func() { + It(`Invoke CreateInstanceGroupManager successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31979,33 +32436,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) + _, _, operationErr := vpcService.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32013,7 +32469,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) + _, _, operationErr = vpcService.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -32027,7 +32483,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -32051,10 +32507,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke CreateInstanceGroupManagerAction successfully`, func() { + It(`Invoke CreateInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32064,36 +32520,35 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(nil) + result, response, operationErr := vpcService.CreateInstanceGroupManager(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceGroupManagerAction with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceGroupManager with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32102,34 +32557,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateInstanceGroupManagerActionOptions model with no property values - createInstanceGroupManagerActionOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerActionOptions) + // Construct a second instance of the CreateInstanceGroupManagerOptions model with no property values + createInstanceGroupManagerOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -32147,7 +32601,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceGroupManagerAction successfully`, func() { + It(`Invoke CreateInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32156,25 +32610,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32186,16 +32639,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions)`, func() { + Describe(`DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions)`, func() { version := "2024-06-23" - deleteInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + deleteInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -32203,7 +32656,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteInstanceGroupManagerAction successfully`, func() { + It(`Invoke DeleteInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32213,23 +32666,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupManagerAction(nil) + response, operationErr := vpcService.DeleteInstanceGroupManager(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerActionOptions model - deleteInstanceGroupManagerActionOptionsModel := new(vpcv1.DeleteInstanceGroupManagerActionOptions) - deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupManagerOptions model + deleteInstanceGroupManagerOptionsModel := new(vpcv1.DeleteInstanceGroupManagerOptions) + deleteInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) + response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceGroupManagerAction with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceGroupManager with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32238,23 +32690,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerActionOptions model - deleteInstanceGroupManagerActionOptionsModel := new(vpcv1.DeleteInstanceGroupManagerActionOptions) - deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupManagerOptions model + deleteInstanceGroupManagerOptionsModel := new(vpcv1.DeleteInstanceGroupManagerOptions) + deleteInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) + response, operationErr := vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupManagerActionOptions model with no property values - deleteInstanceGroupManagerActionOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerActionOptions) + // Construct a second instance of the DeleteInstanceGroupManagerOptions model with no property values + deleteInstanceGroupManagerOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -32263,16 +32714,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) - Operation response error`, func() { + Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + getInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -32281,7 +32732,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroupManagerAction with error: Operation response processing error`, func() { + It(`Invoke GetInstanceGroupManager with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32290,21 +32741,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -32314,16 +32764,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions)`, func() { + Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions)`, func() { version := "2024-06-23" - getInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + getInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -32334,10 +32784,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke GetInstanceGroupManagerAction successfully with retries`, func() { + It(`Invoke GetInstanceGroupManager successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32347,23 +32797,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32371,7 +32820,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -32385,7 +32834,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -32393,10 +32842,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke GetInstanceGroupManagerAction successfully`, func() { + It(`Invoke GetInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32406,26 +32855,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroupManagerAction(nil) + result, response, operationErr := vpcService.GetInstanceGroupManager(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroupManagerAction with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroupManager with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32434,24 +32882,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceGroupManagerActionOptions model with no property values - getInstanceGroupManagerActionOptionsModelNew := new(vpcv1.GetInstanceGroupManagerActionOptions) + // Construct a second instance of the GetInstanceGroupManagerOptions model with no property values + getInstanceGroupManagerOptionsModelNew := new(vpcv1.GetInstanceGroupManagerOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -32469,7 +32916,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroupManagerAction successfully`, func() { + It(`Invoke GetInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32478,15 +32925,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32498,16 +32944,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + updateInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -32516,7 +32962,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroupManagerAction with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroupManager with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32525,43 +32971,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) - instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -32571,16 +33006,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions)`, func() { + Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions)`, func() { version := "2024-06-23" - updateInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + updateInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -32607,10 +33042,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke UpdateInstanceGroupManagerAction successfully with retries`, func() { + It(`Invoke UpdateInstanceGroupManager successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32620,45 +33055,34 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) - instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32666,7 +33090,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -32680,7 +33104,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -32704,10 +33128,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke UpdateInstanceGroupManagerAction successfully`, func() { + It(`Invoke UpdateInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32717,48 +33141,37 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(nil) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) - instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroupManagerAction with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroupManager with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32767,46 +33180,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) - instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceGroupManagerActionOptions model with no property values - updateInstanceGroupManagerActionOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + // Construct a second instance of the UpdateInstanceGroupManagerOptions model with no property values + updateInstanceGroupManagerOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -32824,7 +33226,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroupManagerAction successfully`, func() { + It(`Invoke UpdateInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32833,37 +33235,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) - instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32875,16 +33266,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) - Operation response error`, func() { + Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceGroupManagerPoliciesPath := "/instance_groups/testString/managers/testString/policies" + listInstanceGroupManagerActionsPath := "/instance_groups/testString/managers/testString/actions" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -32895,7 +33286,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroupManagerPolicies with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroupManagerActions with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32904,22 +33295,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -32929,16 +33320,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions)`, func() { + Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions)`, func() { version := "2024-06-23" - listInstanceGroupManagerPoliciesPath := "/instance_groups/testString/managers/testString/policies" + listInstanceGroupManagerActionsPath := "/instance_groups/testString/managers/testString/actions" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -32951,10 +33342,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagerPolicies successfully with retries`, func() { + It(`Invoke ListInstanceGroupManagerActions successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32964,24 +33355,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32989,7 +33380,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33003,7 +33394,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -33013,10 +33404,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagerPolicies successfully`, func() { + It(`Invoke ListInstanceGroupManagerActions successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33026,27 +33417,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(nil) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroupManagerPolicies with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroupManagerActions with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33055,25 +33446,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceGroupManagerPoliciesOptions model with no property values - listInstanceGroupManagerPoliciesOptionsModelNew := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + // Construct a second instance of the ListInstanceGroupManagerActionsOptions model with no property values + listInstanceGroupManagerActionsOptionsModelNew := new(vpcv1.ListInstanceGroupManagerActionsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -33091,7 +33482,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroupManagerPolicies successfully`, func() { + It(`Invoke ListInstanceGroupManagerActions successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33100,16 +33491,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33122,8 +33513,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) - nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -33132,15 +33523,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) + responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) - nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -33156,7 +33547,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -33164,15 +33555,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":11,"policy_type":"target"}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":11,"policy_type":"target"}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use InstanceGroupManagerPoliciesPager.GetNext successfully`, func() { + It(`Use InstanceGroupManagerActionsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33181,17 +33572,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ InstanceGroupID: core.StringPtr("testString"), InstanceGroupManagerID: core.StringPtr("testString"), Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) + pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.InstanceGroupManagerPolicyIntf + var allResults []vpcv1.InstanceGroupManagerActionIntf for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -33200,7 +33591,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use InstanceGroupManagerPoliciesPager.GetAll successfully`, func() { + It(`Use InstanceGroupManagerActionsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33209,13 +33600,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ InstanceGroupID: core.StringPtr("testString"), InstanceGroupManagerID: core.StringPtr("testString"), Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) + pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -33226,16 +33617,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) - Operation response error`, func() { version := "2024-06-23" - createInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies" + createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -33244,7 +33635,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroupManagerPolicy with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceGroupManagerAction with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33253,28 +33644,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33284,16 +33678,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions)`, func() { + Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions)`, func() { version := "2024-06-23" - createInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies" + createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -33320,10 +33714,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke CreateInstanceGroupManagerPolicy successfully with retries`, func() { + It(`Invoke CreateInstanceGroupManagerAction successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33333,30 +33727,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateInstanceGroupManagerPolicyWithContext(ctx, createInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr := vpcService.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33364,7 +33761,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupManagerPolicyWithContext(ctx, createInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr = vpcService.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33378,7 +33775,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -33402,10 +33799,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke CreateInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke CreateInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33415,33 +33812,36 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(nil) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceGroupManagerAction with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33450,31 +33850,34 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateInstanceGroupManagerPolicyOptions model with no property values - createInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + // Construct a second instance of the CreateInstanceGroupManagerActionOptions model with no property values + createInstanceGroupManagerActionOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerActionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -33492,7 +33895,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke CreateInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33501,22 +33904,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33528,16 +33934,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions)`, func() { + Describe(`DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions)`, func() { version := "2024-06-23" - deleteInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + deleteInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -33545,7 +33951,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke DeleteInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33555,23 +33961,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupManagerPolicy(nil) + response, operationErr := vpcService.DeleteInstanceGroupManagerAction(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model - deleteInstanceGroupManagerPolicyOptionsModel := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) - deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupManagerActionOptions model + deleteInstanceGroupManagerActionOptionsModel := new(vpcv1.DeleteInstanceGroupManagerActionOptions) + deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModel) + response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceGroupManagerAction with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33580,23 +33986,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model - deleteInstanceGroupManagerPolicyOptionsModel := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) - deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupManagerActionOptions model + deleteInstanceGroupManagerActionOptionsModel := new(vpcv1.DeleteInstanceGroupManagerActionOptions) + deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModel) + response, operationErr := vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupManagerPolicyOptions model with no property values - deleteInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) + // Construct a second instance of the DeleteInstanceGroupManagerActionOptions model with no property values + deleteInstanceGroupManagerActionOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerActionOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -33605,16 +34011,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) - Operation response error`, func() { version := "2024-06-23" - getInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + getInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -33623,7 +34029,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroupManagerPolicy with error: Operation response processing error`, func() { + It(`Invoke GetInstanceGroupManagerAction with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33632,21 +34038,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33656,16 +34062,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions)`, func() { + Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions)`, func() { version := "2024-06-23" - getInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + getInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -33676,10 +34082,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke GetInstanceGroupManagerPolicy successfully with retries`, func() { + It(`Invoke GetInstanceGroupManagerAction successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33689,23 +34095,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33713,7 +34119,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33727,7 +34133,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -33735,10 +34141,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke GetInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke GetInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33748,26 +34154,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(nil) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroupManagerAction with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33776,24 +34182,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceGroupManagerPolicyOptions model with no property values - getInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + // Construct a second instance of the GetInstanceGroupManagerActionOptions model with no property values + getInstanceGroupManagerActionOptionsModelNew := new(vpcv1.GetInstanceGroupManagerActionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -33811,7 +34217,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke GetInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33820,15 +34226,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33840,16 +34246,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + updateInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -33858,7 +34264,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroupManagerPolicy with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroupManagerAction with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33867,30 +34273,43 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) + instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33900,16 +34319,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions)`, func() { + Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions)`, func() { version := "2024-06-23" - updateInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + updateInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -33936,10 +34355,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke UpdateInstanceGroupManagerPolicy successfully with retries`, func() { + It(`Invoke UpdateInstanceGroupManagerAction successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33949,32 +34368,45 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) + instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33982,7 +34414,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33996,7 +34428,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -34020,10 +34452,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke UpdateInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke UpdateInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34033,35 +34465,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(nil) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) + instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroupManagerAction with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34070,33 +34515,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) + instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceGroupManagerPolicyOptions model with no property values - updateInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + // Construct a second instance of the UpdateInstanceGroupManagerActionOptions model with no property values + updateInstanceGroupManagerActionOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerActionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -34114,7 +34572,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke UpdateInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34123,24 +34581,37 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.AutoDelete = core.BoolPtr(true) + instanceGroupManagerActionPatchModel.AutoDeleteTimeout = core.Int64Ptr(int64(24)) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34152,89 +34623,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions)`, func() { - version := "2024-06-23" - deleteInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupMembershipsPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstanceGroupMemberships successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupMemberships(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceGroupMembershipsOptions model - deleteInstanceGroupMembershipsOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipsOptions) - deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceGroupMemberships with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the DeleteInstanceGroupMembershipsOptions model - deleteInstanceGroupMembershipsOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipsOptions) - deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupMembershipsOptions model with no property values - deleteInstanceGroupMembershipsOptionsModelNew := new(vpcv1.DeleteInstanceGroupMembershipsOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) - Operation response error`, func() { + Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) - Operation response error`, func() { version := "2024-06-23" - listInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" + listInstanceGroupManagerPoliciesPath := "/instance_groups/testString/managers/testString/policies" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -34245,7 +34643,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroupMemberships with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroupManagerPolicies with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34254,21 +34652,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34278,16 +34677,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions)`, func() { + Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions)`, func() { version := "2024-06-23" - listInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" + listInstanceGroupManagerPoliciesPath := "/instance_groups/testString/managers/testString/policies" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -34300,10 +34699,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?limit=20"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}], "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupMemberships successfully with retries`, func() { + It(`Invoke ListInstanceGroupManagerPolicies successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34313,23 +34712,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34337,7 +34737,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34351,7 +34751,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -34361,10 +34761,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?limit=20"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}], "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupMemberships successfully`, func() { + It(`Invoke ListInstanceGroupManagerPolicies successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34374,26 +34774,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroupMemberships(nil) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroupMemberships with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroupManagerPolicies with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34402,24 +34803,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceGroupMembershipsOptions model with no property values - listInstanceGroupMembershipsOptionsModelNew := new(vpcv1.ListInstanceGroupMembershipsOptions) + // Construct a second instance of the ListInstanceGroupManagerPoliciesOptions model with no property values + listInstanceGroupManagerPoliciesOptionsModelNew := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -34437,7 +34839,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroupMemberships successfully`, func() { + It(`Invoke ListInstanceGroupManagerPolicies successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34446,15 +34848,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34467,8 +34870,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupMembershipCollection) - nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -34477,15 +34880,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupMembershipCollection) + responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.InstanceGroupMembershipCollection) - nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -34501,7 +34904,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -34509,15 +34912,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a","id":"0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":11,"policy_type":"target"}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a","id":"0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":11,"policy_type":"target"}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use InstanceGroupMembershipsPager.GetNext successfully`, func() { + It(`Use InstanceGroupManagerPoliciesPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34526,16 +34929,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr("testString"), + InstanceGroupManagerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) + pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.InstanceGroupMembership + var allResults []vpcv1.InstanceGroupManagerPolicyIntf for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -34544,7 +34948,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use InstanceGroupMembershipsPager.GetAll successfully`, func() { + It(`Use InstanceGroupManagerPoliciesPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34553,12 +34957,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr("testString"), + InstanceGroupManagerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) + pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -34569,24 +34974,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions)`, func() { + Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { version := "2024-06-23" - deleteInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" - Context(`Using mock server endpoint`, func() { + createInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("DELETE")) - + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteInstanceGroupMembership successfully`, func() { + It(`Invoke CreateInstanceGroupManagerPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34595,65 +35001,368 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupMembership(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") - // Construct an instance of the DeleteInstanceGroupMembershipOptions model - deleteInstanceGroupMembershipOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipOptions) - deleteInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModel) - Expect(operationErr).To(BeNil()) + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) - It(`Invoke DeleteInstanceGroupMembership with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions)`, func() { + version := "2024-06-23" + createInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + })) + }) + It(`Invoke CreateInstanceGroupManagerPolicy successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteInstanceGroupMembershipOptions model - deleteInstanceGroupMembershipOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipOptions) - deleteInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.CreateInstanceGroupManagerPolicyWithContext(ctx, createInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.CreateInstanceGroupManagerPolicyWithContext(ctx, createInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + })) + }) + It(`Invoke CreateInstanceGroupManagerPolicy successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupMembershipOptions model with no property values - deleteInstanceGroupMembershipOptionsModelNew := new(vpcv1.DeleteInstanceGroupMembershipOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateInstanceGroupManagerPolicyOptions model with no property values + createInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateInstanceGroupManagerPolicy successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) - Operation response error`, func() { + Describe(`DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions)`, func() { version := "2024-06-23" - getInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" + deleteInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceGroupManagerPolicy successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteInstanceGroupManagerPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model + deleteInstanceGroupManagerPolicyOptionsModel := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) + deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model + deleteInstanceGroupManagerPolicyOptionsModel := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) + deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceGroupManagerPolicyOptions model with no property values + deleteInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + version := "2024-06-23" + getInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -34662,7 +35371,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroupMembership with error: Operation response processing error`, func() { + It(`Invoke GetInstanceGroupManagerPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34671,20 +35380,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34694,16 +35404,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions)`, func() { + Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions)`, func() { version := "2024-06-23" - getInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" + getInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -34714,10 +35424,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke GetInstanceGroupMembership successfully with retries`, func() { + It(`Invoke GetInstanceGroupManagerPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34727,22 +35437,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34750,7 +35461,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34764,7 +35475,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -34772,10 +35483,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke GetInstanceGroupMembership successfully`, func() { + It(`Invoke GetInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34785,25 +35496,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroupMembership(nil) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroupMembership with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34812,23 +35524,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetInstanceGroupMembershipOptions model with no property values - getInstanceGroupMembershipOptionsModelNew := new(vpcv1.GetInstanceGroupMembershipOptions) + // Construct a second instance of the GetInstanceGroupManagerPolicyOptions model with no property values + getInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.GetInstanceGroupManagerPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -34846,7 +35559,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroupMembership successfully`, func() { + It(`Invoke GetInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34855,14 +35568,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34874,16 +35588,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { version := "2024-06-23" - updateInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" + updateInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -34892,7 +35606,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroupMembership with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34901,28 +35615,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34932,16 +35648,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions)`, func() { + Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions)`, func() { version := "2024-06-23" - updateInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" + updateInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -34968,10 +35684,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke UpdateInstanceGroupMembership successfully with retries`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34981,30 +35697,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35012,7 +35730,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35026,7 +35744,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -35050,10 +35768,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke UpdateInstanceGroupMembership successfully`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35063,33 +35781,35 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroupMembership(nil) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroupMembership with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35098,31 +35818,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateInstanceGroupMembershipOptions model with no property values - updateInstanceGroupMembershipOptionsModelNew := new(vpcv1.UpdateInstanceGroupMembershipOptions) + // Construct a second instance of the UpdateInstanceGroupManagerPolicyOptions model with no property values + updateInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -35140,7 +35862,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroupMembership successfully`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35149,22 +35871,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35176,30 +35900,100 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListReservations(listReservationsOptions *ListReservationsOptions) - Operation response error`, func() { + Describe(`DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions)`, func() { version := "2024-06-23" - listReservationsPath := "/reservations" + deleteInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupMembershipsPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceGroupMemberships successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteInstanceGroupMemberships(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInstanceGroupMembershipsOptions model + deleteInstanceGroupMembershipsOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipsOptions) + deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceGroupMemberships with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteInstanceGroupMembershipsOptions model + deleteInstanceGroupMembershipsOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipsOptions) + deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceGroupMembershipsOptions model with no property values + deleteInstanceGroupMembershipsOptionsModelNew := new(vpcv1.DeleteInstanceGroupMembershipsOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) - Operation response error`, func() { + version := "2024-06-23" + listInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listReservationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListReservations with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroupMemberships with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35208,23 +36002,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListReservationsOptions model - listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) - listReservationsOptionsModel.Start = core.StringPtr("testString") - listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listReservationsOptionsModel.Name = core.StringPtr("my-name") - listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListReservations(listReservationsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListReservations(listReservationsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -35234,35 +36026,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListReservations(listReservationsOptions *ListReservationsOptions)`, func() { + Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions)`, func() { version := "2024-06-23" - listReservationsPath := "/reservations" + listInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listReservationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/reservations?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/reservations?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "reservations": [{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListReservations successfully with retries`, func() { + It(`Invoke ListInstanceGroupMemberships successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35272,25 +36061,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListReservationsOptions model - listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) - listReservationsOptionsModel.Start = core.StringPtr("testString") - listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listReservationsOptionsModel.Name = core.StringPtr("my-name") - listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListReservationsWithContext(ctx, listReservationsOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListReservations(listReservationsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35298,7 +36085,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListReservationsWithContext(ctx, listReservationsOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35312,23 +36099,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listReservationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/reservations?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/reservations?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "reservations": [{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListReservations successfully`, func() { + It(`Invoke ListInstanceGroupMemberships successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35338,28 +36122,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListReservations(nil) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListReservationsOptions model - listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) - listReservationsOptionsModel.Start = core.StringPtr("testString") - listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listReservationsOptionsModel.Name = core.StringPtr("my-name") - listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListReservations(listReservationsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListReservations with error: Operation request error`, func() { + It(`Invoke ListInstanceGroupMemberships with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35368,22 +36150,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListReservationsOptions model - listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) - listReservationsOptionsModel.Start = core.StringPtr("testString") - listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listReservationsOptionsModel.Name = core.StringPtr("my-name") - listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListReservations(listReservationsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ListInstanceGroupMembershipsOptions model with no property values + listInstanceGroupMembershipsOptionsModelNew := new(vpcv1.ListInstanceGroupMembershipsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -35398,7 +36185,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListReservations successfully`, func() { + It(`Invoke ListInstanceGroupMemberships successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35407,17 +36194,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListReservationsOptions model - listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) - listReservationsOptionsModel.Start = core.StringPtr("testString") - listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listReservationsOptionsModel.Name = core.StringPtr("my-name") - listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListReservations(listReservationsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35430,8 +36215,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ReservationCollection) - nextObject := new(vpcv1.ReservationCollectionNext) + responseObject := new(vpcv1.InstanceGroupMembershipCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -35440,15 +36225,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.ReservationCollection) + responseObject := new(vpcv1.InstanceGroupMembershipCollection) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.ReservationCollection) - nextObject := new(vpcv1.ReservationCollectionNext) + responseObject := new(vpcv1.InstanceGroupMembershipCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -35464,7 +36249,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listReservationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -35472,15 +36257,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"reservations":[{"affinity_policy":"restricted","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"Term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"7187-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"reservations":[{"affinity_policy":"restricted","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"Term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"7187-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use ReservationsPager.GetNext successfully`, func() { + It(`Use InstanceGroupMembershipsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35489,18 +36274,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listReservationsOptionsModel := &vpcv1.ListReservationsOptions{ + listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr("testString"), Limit: core.Int64Ptr(int64(10)), - Name: core.StringPtr("my-name"), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), } - pager, err := vpcService.NewReservationsPager(listReservationsOptionsModel) + pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.Reservation + var allResults []vpcv1.InstanceGroupMembership for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -35509,7 +36292,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use ReservationsPager.GetAll successfully`, func() { + It(`Use InstanceGroupMembershipsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35518,14 +36301,12 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listReservationsOptionsModel := &vpcv1.ListReservationsOptions{ + listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr("testString"), Limit: core.Int64Ptr(int64(10)), - Name: core.StringPtr("my-name"), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), } - pager, err := vpcService.NewReservationsPager(listReservationsOptionsModel) + pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -35536,25 +36317,24 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateReservation(createReservationOptions *CreateReservationOptions) - Operation response error`, func() { + Describe(`DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions)`, func() { version := "2024-06-23" - createReservationPath := "/reservations" - Context(`Using mock server endpoint with invalid JSON response`, func() { + deleteInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createReservationPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke CreateReservation with error: Operation response processing error`, func() { + It(`Invoke DeleteInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35563,47 +36343,96 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ReservationCapacityPrototype model - reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) - reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteInstanceGroupMembership(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Construct an instance of the ReservationCommittedUsePrototype model - reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) - reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") + // Construct an instance of the DeleteInstanceGroupMembershipOptions model + deleteInstanceGroupMembershipOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipOptions) + deleteInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the ReservationProfilePrototype model - reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) - reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceGroupMembership with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") + // Construct an instance of the DeleteInstanceGroupMembershipOptions model + deleteInstanceGroupMembershipOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipOptions) + deleteInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceGroupMembershipOptions model with no property values + deleteInstanceGroupMembershipOptionsModelNew := new(vpcv1.DeleteInstanceGroupMembershipOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) - Operation response error`, func() { + version := "2024-06-23" + getInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetInstanceGroupMembership with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateReservationOptions model - createReservationOptionsModel := new(vpcv1.CreateReservationOptions) - createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel - createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel - createReservationOptionsModel.Profile = reservationProfilePrototypeModel - createReservationOptionsModel.Zone = zoneIdentityModel - createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") - createReservationOptionsModel.Name = core.StringPtr("my-reservation") - createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel - createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateReservation(createReservationOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateReservation(createReservationOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -35613,33 +36442,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateReservation(createReservationOptions *CreateReservationOptions)`, func() { + Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions)`, func() { version := "2024-06-23" - createReservationPath := "/reservations" + getInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createReservationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -35648,11 +36461,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke CreateReservation successfully with retries`, func() { + It(`Invoke GetInstanceGroupMembership successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35662,49 +36475,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ReservationCapacityPrototype model - reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) - reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) - - // Construct an instance of the ReservationCommittedUsePrototype model - reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) - reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") - - // Construct an instance of the ReservationProfilePrototype model - reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) - reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateReservationOptions model - createReservationOptionsModel := new(vpcv1.CreateReservationOptions) - createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel - createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel - createReservationOptionsModel.Profile = reservationProfilePrototypeModel - createReservationOptionsModel.Zone = zoneIdentityModel - createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") - createReservationOptionsModel.Name = core.StringPtr("my-reservation") - createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel - createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateReservationWithContext(ctx, createReservationOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateReservation(createReservationOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35712,7 +36498,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateReservationWithContext(ctx, createReservationOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35726,34 +36512,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createReservationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke CreateReservation successfully`, func() { + It(`Invoke GetInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35763,52 +36533,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateReservation(nil) + result, response, operationErr := vpcService.GetInstanceGroupMembership(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ReservationCapacityPrototype model - reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) - reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) - - // Construct an instance of the ReservationCommittedUsePrototype model - reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) - reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") - - // Construct an instance of the ReservationProfilePrototype model - reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) - reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateReservationOptions model - createReservationOptionsModel := new(vpcv1.CreateReservationOptions) - createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel - createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel - createReservationOptionsModel.Profile = reservationProfilePrototypeModel - createReservationOptionsModel.Zone = zoneIdentityModel - createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") - createReservationOptionsModel.Name = core.StringPtr("my-reservation") - createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel - createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateReservation(createReservationOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateReservation with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroupMembership with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35817,50 +36560,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ReservationCapacityPrototype model - reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) - reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) - - // Construct an instance of the ReservationCommittedUsePrototype model - reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) - reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") - - // Construct an instance of the ReservationProfilePrototype model - reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) - reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateReservationOptions model - createReservationOptionsModel := new(vpcv1.CreateReservationOptions) - createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel - createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel - createReservationOptionsModel.Profile = reservationProfilePrototypeModel - createReservationOptionsModel.Zone = zoneIdentityModel - createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") - createReservationOptionsModel.Name = core.StringPtr("my-reservation") - createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel - createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateReservation(createReservationOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateReservationOptions model with no property values - createReservationOptionsModelNew := new(vpcv1.CreateReservationOptions) + // Construct a second instance of the GetInstanceGroupMembershipOptions model with no property values + getInstanceGroupMembershipOptionsModelNew := new(vpcv1.GetInstanceGroupMembershipOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateReservation(createReservationOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -35875,10 +36591,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateReservation successfully`, func() { + It(`Invoke GetInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35887,41 +36603,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ReservationCapacityPrototype model - reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) - reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) - - // Construct an instance of the ReservationCommittedUsePrototype model - reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) - reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") - - // Construct an instance of the ReservationProfilePrototype model - reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) - reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateReservationOptions model - createReservationOptionsModel := new(vpcv1.CreateReservationOptions) - createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel - createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel - createReservationOptionsModel.Profile = reservationProfilePrototypeModel - createReservationOptionsModel.Zone = zoneIdentityModel - createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") - createReservationOptionsModel.Name = core.StringPtr("my-reservation") - createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel - createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateReservation(createReservationOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35933,25 +36622,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteReservation(deleteReservationOptions *DeleteReservationOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) - Operation response error`, func() { version := "2024-06-23" - deleteReservationPath := "/reservations/testString" + updateInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteReservationPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteReservation with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroupMembership with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35960,19 +36649,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteReservationOptions model - deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) - deleteReservationOptionsModel.ID = core.StringPtr("testString") - deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.DeleteReservation(deleteReservationOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.DeleteReservation(deleteReservationOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -35982,17 +36680,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteReservation(deleteReservationOptions *DeleteReservationOptions)`, func() { + Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions)`, func() { version := "2024-06-23" - deleteReservationPath := "/reservations/testString" + updateInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteReservationPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -36001,11 +36715,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke DeleteReservation successfully with retries`, func() { + It(`Invoke UpdateInstanceGroupMembership successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36015,21 +36729,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteReservationOptions model - deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) - deleteReservationOptionsModel.ID = core.StringPtr("testString") - deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.DeleteReservationWithContext(ctx, deleteReservationOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteReservation(deleteReservationOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -36037,7 +36760,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteReservationWithContext(ctx, deleteReservationOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -36051,18 +36774,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteReservationPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke DeleteReservation successfully`, func() { + It(`Invoke UpdateInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36072,24 +36811,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteReservation(nil) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteReservationOptions model - deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) - deleteReservationOptionsModel.ID = core.StringPtr("testString") - deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteReservation(deleteReservationOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteReservation with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroupMembership with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36098,22 +36846,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteReservationOptions model - deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) - deleteReservationOptionsModel.ID = core.StringPtr("testString") - deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.DeleteReservation(deleteReservationOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeleteReservationOptions model with no property values - deleteReservationOptionsModelNew := new(vpcv1.DeleteReservationOptions) + // Construct a second instance of the UpdateInstanceGroupMembershipOptions model with no property values + updateInstanceGroupMembershipOptionsModelNew := new(vpcv1.UpdateInstanceGroupMembershipOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteReservation(deleteReservationOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -36128,10 +36885,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke DeleteReservation successfully`, func() { + It(`Invoke UpdateInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36140,13 +36897,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteReservationOptions model - deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) - deleteReservationOptionsModel.ID = core.StringPtr("testString") - deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.DeleteInstanceOnMembershipDelete = core.BoolPtr(true) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteReservation(deleteReservationOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -36158,25 +36924,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetReservation(getReservationOptions *GetReservationOptions) - Operation response error`, func() { + Describe(`ListReservations(listReservationsOptions *ListReservationsOptions) - Operation response error`, func() { version := "2024-06-23" - getReservationPath := "/reservations/testString" + listReservationsPath := "/reservations" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getReservationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listReservationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetReservation with error: Operation response processing error`, func() { + It(`Invoke ListReservations with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36185,19 +36956,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetReservationOptions model - getReservationOptionsModel := new(vpcv1.GetReservationOptions) - getReservationOptionsModel.ID = core.StringPtr("testString") - getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListReservationsOptions model + listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) + listReservationsOptionsModel.Start = core.StringPtr("testString") + listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listReservationsOptionsModel.Name = core.StringPtr("my-name") + listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetReservation(getReservationOptionsModel) + result, response, operationErr := vpcService.ListReservations(listReservationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetReservation(getReservationOptionsModel) + result, response, operationErr = vpcService.ListReservations(listReservationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -36207,30 +36982,35 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetReservation(getReservationOptions *GetReservationOptions)`, func() { + Describe(`ListReservations(listReservationsOptions *ListReservationsOptions)`, func() { version := "2024-06-23" - getReservationPath := "/reservations/testString" + listReservationsPath := "/reservations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getReservationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listReservationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "reservations": [{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) - It(`Invoke GetReservation successfully with retries`, func() { + It(`Invoke ListReservations successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36240,21 +37020,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetReservationOptions model - getReservationOptionsModel := new(vpcv1.GetReservationOptions) - getReservationOptionsModel.ID = core.StringPtr("testString") - getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListReservationsOptions model + listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) + listReservationsOptionsModel.Start = core.StringPtr("testString") + listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listReservationsOptionsModel.Name = core.StringPtr("my-name") + listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetReservationWithContext(ctx, getReservationOptionsModel) + _, _, operationErr := vpcService.ListReservationsWithContext(ctx, listReservationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetReservation(getReservationOptionsModel) + result, response, operationErr := vpcService.ListReservations(listReservationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -36262,7 +37046,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetReservationWithContext(ctx, getReservationOptionsModel) + _, _, operationErr = vpcService.ListReservationsWithContext(ctx, listReservationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -36276,18 +37060,23 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getReservationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listReservationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "reservations": [{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) - It(`Invoke GetReservation successfully`, func() { + It(`Invoke ListReservations successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36297,24 +37086,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetReservation(nil) + result, response, operationErr := vpcService.ListReservations(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetReservationOptions model - getReservationOptionsModel := new(vpcv1.GetReservationOptions) - getReservationOptionsModel.ID = core.StringPtr("testString") - getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListReservationsOptions model + listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) + listReservationsOptionsModel.Start = core.StringPtr("testString") + listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listReservationsOptionsModel.Name = core.StringPtr("my-name") + listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetReservation(getReservationOptionsModel) + result, response, operationErr = vpcService.ListReservations(listReservationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetReservation with error: Operation validation and request error`, func() { + It(`Invoke ListReservations with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36323,25 +37116,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetReservationOptions model - getReservationOptionsModel := new(vpcv1.GetReservationOptions) - getReservationOptionsModel.ID = core.StringPtr("testString") - getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListReservationsOptions model + listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) + listReservationsOptionsModel.Start = core.StringPtr("testString") + listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listReservationsOptionsModel.Name = core.StringPtr("my-name") + listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetReservation(getReservationOptionsModel) + result, response, operationErr := vpcService.ListReservations(listReservationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetReservationOptions model with no property values - getReservationOptionsModelNew := new(vpcv1.GetReservationOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetReservation(getReservationOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -36356,7 +37146,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetReservation successfully`, func() { + It(`Invoke ListReservations successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36365,13 +37155,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetReservationOptions model - getReservationOptionsModel := new(vpcv1.GetReservationOptions) - getReservationOptionsModel.ID = core.StringPtr("testString") - getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListReservationsOptions model + listReservationsOptionsModel := new(vpcv1.ListReservationsOptions) + listReservationsOptionsModel.Start = core.StringPtr("testString") + listReservationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listReservationsOptionsModel.Name = core.StringPtr("my-name") + listReservationsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listReservationsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listReservationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetReservation(getReservationOptionsModel) + result, response, operationErr := vpcService.ListReservations(listReservationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -36382,26 +37176,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`UpdateReservation(updateReservationOptions *UpdateReservationOptions) - Operation response error`, func() { - version := "2024-06-23" - updateReservationPath := "/reservations/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ReservationCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ReservationCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ReservationCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateReservationPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.EscapedPath()).To(Equal(listReservationsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"reservations":[{"affinity_policy":"restricted","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"Term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"reservations":[{"affinity_policy":"restricted","capacity":{"allocated":10,"available":8,"status":"allocated","total":10,"used":2},"committed_use":{"expiration_at":"2019-01-01T12:00:00.000Z","expiration_policy":"release","term":"Term"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63","href":"https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63","id":"0717-ba49df72-37b8-43ac-98da-f8e029de0e63","lifecycle_state":"stable","name":"my-reservation","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"reservation","status":"activating","status_reasons":[{"code":"cannot_activate_no_capacity_available","message":"The reservation cannot be activated because capacity is unavailable","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke UpdateReservation with error: Operation response processing error`, func() { + It(`Use ReservationsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36410,43 +37237,121 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ReservationCapacityPatch model - reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) - reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) - - // Construct an instance of the ReservationCommittedUsePatch model - reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) - reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePatchModel.Term = core.StringPtr("testString") + listReservationsOptionsModel := &vpcv1.ListReservationsOptions{ + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + } - // Construct an instance of the ReservationProfilePatch model - reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) - reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") + pager, err := vpcService.NewReservationsPager(listReservationsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Construct an instance of the ReservationPatch model - reservationPatchModel := new(vpcv1.ReservationPatch) - reservationPatchModel.Capacity = reservationCapacityPatchModel - reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel - reservationPatchModel.Name = core.StringPtr("my-reservation") - reservationPatchModel.Profile = reservationProfilePatchModel - reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + var allResults []vpcv1.Reservation + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ReservationsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the UpdateReservationOptions model - updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) - updateReservationOptionsModel.ID = core.StringPtr("testString") - updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch - updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + listReservationsOptionsModel := &vpcv1.ListReservationsOptions{ + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + } + + pager, err := vpcService.NewReservationsPager(listReservationsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateReservation(createReservationOptions *CreateReservationOptions) - Operation response error`, func() { + version := "2024-06-23" + createReservationPath := "/reservations" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createReservationPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateReservation with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ReservationCapacityPrototype model + reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) + reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) + + // Construct an instance of the ReservationCommittedUsePrototype model + reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) + reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") + + // Construct an instance of the ReservationProfilePrototype model + reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) + reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateReservationOptions model + createReservationOptionsModel := new(vpcv1.CreateReservationOptions) + createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel + createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel + createReservationOptionsModel.Profile = reservationProfilePrototypeModel + createReservationOptionsModel.Zone = zoneIdentityModel + createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") + createReservationOptionsModel.Name = core.StringPtr("my-reservation") + createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel + createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateReservation(updateReservationOptionsModel) + result, response, operationErr := vpcService.CreateReservation(createReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateReservation(updateReservationOptionsModel) + result, response, operationErr = vpcService.CreateReservation(createReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -36456,17 +37361,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateReservation(updateReservationOptions *UpdateReservationOptions)`, func() { + Describe(`CreateReservation(createReservationOptions *CreateReservationOptions)`, func() { version := "2024-06-23" - updateReservationPath := "/reservations/testString" + createReservationPath := "/reservations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateReservationPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createReservationPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -36491,11 +37396,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateReservation successfully with retries`, func() { + It(`Invoke CreateReservation successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36505,45 +37410,49 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ReservationCapacityPatch model - reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) - reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) + // Construct an instance of the ReservationCapacityPrototype model + reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) + reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) - // Construct an instance of the ReservationCommittedUsePatch model - reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) - reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePatchModel.Term = core.StringPtr("testString") + // Construct an instance of the ReservationCommittedUsePrototype model + reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) + reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") - // Construct an instance of the ReservationProfilePatch model - reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) - reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") + // Construct an instance of the ReservationProfilePrototype model + reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) + reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") - // Construct an instance of the ReservationPatch model - reservationPatchModel := new(vpcv1.ReservationPatch) - reservationPatchModel.Capacity = reservationCapacityPatchModel - reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel - reservationPatchModel.Name = core.StringPtr("my-reservation") - reservationPatchModel.Profile = reservationProfilePatchModel - reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateReservationOptions model - updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) - updateReservationOptionsModel.ID = core.StringPtr("testString") - updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch - updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateReservationOptions model + createReservationOptionsModel := new(vpcv1.CreateReservationOptions) + createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel + createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel + createReservationOptionsModel.Profile = reservationProfilePrototypeModel + createReservationOptionsModel.Zone = zoneIdentityModel + createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") + createReservationOptionsModel.Name = core.StringPtr("my-reservation") + createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel + createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateReservationWithContext(ctx, updateReservationOptionsModel) + _, _, operationErr := vpcService.CreateReservationWithContext(ctx, createReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateReservation(updateReservationOptionsModel) + result, response, operationErr := vpcService.CreateReservation(createReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -36551,7 +37460,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateReservationWithContext(ctx, updateReservationOptionsModel) + _, _, operationErr = vpcService.CreateReservationWithContext(ctx, createReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -36565,8 +37474,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateReservationPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createReservationPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -36588,11 +37497,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "7187-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateReservation successfully`, func() { + It(`Invoke CreateReservation successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36602,48 +37511,52 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateReservation(nil) + result, response, operationErr := vpcService.CreateReservation(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ReservationCapacityPatch model - reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) - reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) + // Construct an instance of the ReservationCapacityPrototype model + reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) + reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) - // Construct an instance of the ReservationCommittedUsePatch model - reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) - reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePatchModel.Term = core.StringPtr("testString") + // Construct an instance of the ReservationCommittedUsePrototype model + reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) + reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") - // Construct an instance of the ReservationProfilePatch model - reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) - reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") + // Construct an instance of the ReservationProfilePrototype model + reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) + reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") - // Construct an instance of the ReservationPatch model - reservationPatchModel := new(vpcv1.ReservationPatch) - reservationPatchModel.Capacity = reservationCapacityPatchModel - reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel - reservationPatchModel.Name = core.StringPtr("my-reservation") - reservationPatchModel.Profile = reservationProfilePatchModel - reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateReservationOptions model - updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) - updateReservationOptionsModel.ID = core.StringPtr("testString") - updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch - updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateReservationOptions model + createReservationOptionsModel := new(vpcv1.CreateReservationOptions) + createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel + createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel + createReservationOptionsModel.Profile = reservationProfilePrototypeModel + createReservationOptionsModel.Zone = zoneIdentityModel + createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") + createReservationOptionsModel.Name = core.StringPtr("my-reservation") + createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel + createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateReservation(updateReservationOptionsModel) + result, response, operationErr = vpcService.CreateReservation(createReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateReservation with error: Operation validation and request error`, func() { + It(`Invoke CreateReservation with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36652,46 +37565,50 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ReservationCapacityPatch model - reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) - reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) + // Construct an instance of the ReservationCapacityPrototype model + reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) + reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) - // Construct an instance of the ReservationCommittedUsePatch model - reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) - reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePatchModel.Term = core.StringPtr("testString") + // Construct an instance of the ReservationCommittedUsePrototype model + reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) + reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") - // Construct an instance of the ReservationProfilePatch model - reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) - reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") + // Construct an instance of the ReservationProfilePrototype model + reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) + reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") - // Construct an instance of the ReservationPatch model - reservationPatchModel := new(vpcv1.ReservationPatch) - reservationPatchModel.Capacity = reservationCapacityPatchModel - reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel - reservationPatchModel.Name = core.StringPtr("my-reservation") - reservationPatchModel.Profile = reservationProfilePatchModel - reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateReservationOptions model - updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) - updateReservationOptionsModel.ID = core.StringPtr("testString") - updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch - updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateReservationOptions model + createReservationOptionsModel := new(vpcv1.CreateReservationOptions) + createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel + createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel + createReservationOptionsModel.Profile = reservationProfilePrototypeModel + createReservationOptionsModel.Zone = zoneIdentityModel + createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") + createReservationOptionsModel.Name = core.StringPtr("my-reservation") + createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel + createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateReservation(updateReservationOptionsModel) + result, response, operationErr := vpcService.CreateReservation(createReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateReservationOptions model with no property values - updateReservationOptionsModelNew := new(vpcv1.UpdateReservationOptions) + // Construct a second instance of the CreateReservationOptions model with no property values + createReservationOptionsModelNew := new(vpcv1.CreateReservationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateReservation(updateReservationOptionsModelNew) + result, response, operationErr = vpcService.CreateReservation(createReservationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -36706,10 +37623,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateReservation successfully`, func() { + It(`Invoke CreateReservation successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36718,37 +37635,41 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ReservationCapacityPatch model - reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) - reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) + // Construct an instance of the ReservationCapacityPrototype model + reservationCapacityPrototypeModel := new(vpcv1.ReservationCapacityPrototype) + reservationCapacityPrototypeModel.Total = core.Int64Ptr(int64(10)) - // Construct an instance of the ReservationCommittedUsePatch model - reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) - reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") - reservationCommittedUsePatchModel.Term = core.StringPtr("testString") + // Construct an instance of the ReservationCommittedUsePrototype model + reservationCommittedUsePrototypeModel := new(vpcv1.ReservationCommittedUsePrototype) + reservationCommittedUsePrototypeModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePrototypeModel.Term = core.StringPtr("testString") - // Construct an instance of the ReservationProfilePatch model - reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) - reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") - reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") + // Construct an instance of the ReservationProfilePrototype model + reservationProfilePrototypeModel := new(vpcv1.ReservationProfilePrototype) + reservationProfilePrototypeModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePrototypeModel.ResourceType = core.StringPtr("instance_profile") - // Construct an instance of the ReservationPatch model - reservationPatchModel := new(vpcv1.ReservationPatch) - reservationPatchModel.Capacity = reservationCapacityPatchModel - reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel - reservationPatchModel.Name = core.StringPtr("my-reservation") - reservationPatchModel.Profile = reservationProfilePatchModel - reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateReservationOptions model - updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) - updateReservationOptionsModel.ID = core.StringPtr("testString") - updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch - updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateReservationOptions model + createReservationOptionsModel := new(vpcv1.CreateReservationOptions) + createReservationOptionsModel.Capacity = reservationCapacityPrototypeModel + createReservationOptionsModel.CommittedUse = reservationCommittedUsePrototypeModel + createReservationOptionsModel.Profile = reservationProfilePrototypeModel + createReservationOptionsModel.Zone = zoneIdentityModel + createReservationOptionsModel.AffinityPolicy = core.StringPtr("restricted") + createReservationOptionsModel.Name = core.StringPtr("my-reservation") + createReservationOptionsModel.ResourceGroup = resourceGroupIdentityModel + createReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateReservation(updateReservationOptionsModel) + result, response, operationErr := vpcService.CreateReservation(createReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -36760,103 +37681,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ActivateReservation(activateReservationOptions *ActivateReservationOptions)`, func() { - version := "2024-06-23" - activateReservationPath := "/reservations/testString/activate" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(activateReservationPath)) - Expect(req.Method).To(Equal("POST")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke ActivateReservation successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.ActivateReservation(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the ActivateReservationOptions model - activateReservationOptionsModel := new(vpcv1.ActivateReservationOptions) - activateReservationOptionsModel.ID = core.StringPtr("testString") - activateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.ActivateReservation(activateReservationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke ActivateReservation with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ActivateReservationOptions model - activateReservationOptionsModel := new(vpcv1.ActivateReservationOptions) - activateReservationOptionsModel.ID = core.StringPtr("testString") - activateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.ActivateReservation(activateReservationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the ActivateReservationOptions model with no property values - activateReservationOptionsModelNew := new(vpcv1.ActivateReservationOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.ActivateReservation(activateReservationOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) - Operation response error`, func() { + Describe(`DeleteReservation(deleteReservationOptions *DeleteReservationOptions) - Operation response error`, func() { version := "2024-06-23" - listDedicatedHostGroupsPath := "/dedicated_host/groups" + deleteReservationPath := "/reservations/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteReservationPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDedicatedHostGroups with error: Operation response processing error`, func() { + It(`Invoke DeleteReservation with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36865,23 +37708,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteReservationOptions model + deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) + deleteReservationOptionsModel.ID = core.StringPtr("testString") + deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr := vpcService.DeleteReservation(deleteReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr = vpcService.DeleteReservation(deleteReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -36891,35 +37730,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions)`, func() { + Describe(`DeleteReservation(deleteReservationOptions *DeleteReservationOptions)`, func() { version := "2024-06-23" - listDedicatedHostGroupsPath := "/dedicated_host/groups" + deleteReservationPath := "/reservations/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteReservationPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?limit=20"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListDedicatedHostGroups successfully with retries`, func() { + It(`Invoke DeleteReservation successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36929,25 +37763,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - + // Construct an instance of the DeleteReservationOptions model + deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) + deleteReservationOptionsModel.ID = core.StringPtr("testString") + deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) + _, _, operationErr := vpcService.DeleteReservationWithContext(ctx, deleteReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr := vpcService.DeleteReservation(deleteReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -36955,7 +37785,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) + _, _, operationErr = vpcService.DeleteReservationWithContext(ctx, deleteReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -36969,23 +37799,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteReservationPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?limit=20"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListDedicatedHostGroups successfully`, func() { + It(`Invoke DeleteReservation successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36995,28 +37820,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListDedicatedHostGroups(nil) + result, response, operationErr := vpcService.DeleteReservation(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteReservationOptions model + deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) + deleteReservationOptionsModel.ID = core.StringPtr("testString") + deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr = vpcService.DeleteReservation(deleteReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDedicatedHostGroups with error: Operation request error`, func() { + It(`Invoke DeleteReservation with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37025,22 +37846,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteReservationOptions model + deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) + deleteReservationOptionsModel.ID = core.StringPtr("testString") + deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr := vpcService.DeleteReservation(deleteReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the DeleteReservationOptions model with no property values + deleteReservationOptionsModelNew := new(vpcv1.DeleteReservationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.DeleteReservation(deleteReservationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -37052,10 +37876,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke ListDedicatedHostGroups successfully`, func() { + It(`Invoke DeleteReservation successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37064,17 +37888,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteReservationOptions model + deleteReservationOptionsModel := new(vpcv1.DeleteReservationOptions) + deleteReservationOptionsModel.ID = core.StringPtr("testString") + deleteReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr := vpcService.DeleteReservation(deleteReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -37085,133 +37905,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.DedicatedHostGroupCollection) - nextObject := new(vpcv1.DedicatedHostGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.DedicatedHostGroupCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.DedicatedHostGroupCollection) - nextObject := new(vpcv1.DedicatedHostGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use DedicatedHostGroupsPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listDedicatedHostGroupsOptionsModel := &vpcv1.ListDedicatedHostGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), - Name: core.StringPtr("my-name"), - } - - pager, err := vpcService.NewDedicatedHostGroupsPager(listDedicatedHostGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.DedicatedHostGroup - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use DedicatedHostGroupsPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listDedicatedHostGroupsOptionsModel := &vpcv1.ListDedicatedHostGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), - Name: core.StringPtr("my-name"), - } - - pager, err := vpcService.NewDedicatedHostGroupsPager(listDedicatedHostGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) - Operation response error`, func() { + Describe(`GetReservation(getReservationOptions *GetReservationOptions) - Operation response error`, func() { version := "2024-06-23" - createDedicatedHostGroupPath := "/dedicated_host/groups" + getReservationPath := "/reservations/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getReservationPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateDedicatedHostGroup with error: Operation response processing error`, func() { + It(`Invoke GetReservation with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37220,31 +37933,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetReservationOptions model + getReservationOptionsModel := new(vpcv1.GetReservationOptions) + getReservationOptionsModel.ID = core.StringPtr("testString") + getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.GetReservation(getReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.GetReservation(getReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -37254,33 +37955,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions)`, func() { + Describe(`GetReservation(getReservationOptions *GetReservationOptions)`, func() { version := "2024-06-23" - createDedicatedHostGroupPath := "/dedicated_host/groups" + getReservationPath := "/reservations/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getReservationPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -37289,11 +37974,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateDedicatedHostGroup successfully with retries`, func() { + It(`Invoke GetReservation successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37303,33 +37988,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetReservationOptions model + getReservationOptionsModel := new(vpcv1.GetReservationOptions) + getReservationOptionsModel.ID = core.StringPtr("testString") + getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) + _, _, operationErr := vpcService.GetReservationWithContext(ctx, getReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.GetReservation(getReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -37337,7 +38010,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) + _, _, operationErr = vpcService.GetReservationWithContext(ctx, getReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -37351,34 +38024,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getReservationPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateDedicatedHostGroup successfully`, func() { + It(`Invoke GetReservation successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37388,36 +38045,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateDedicatedHostGroup(nil) + result, response, operationErr := vpcService.GetReservation(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetReservationOptions model + getReservationOptionsModel := new(vpcv1.GetReservationOptions) + getReservationOptionsModel.ID = core.StringPtr("testString") + getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.GetReservation(getReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateDedicatedHostGroup with error: Operation validation and request error`, func() { + It(`Invoke GetReservation with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37426,34 +38071,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetReservationOptions model + getReservationOptionsModel := new(vpcv1.GetReservationOptions) + getReservationOptionsModel.ID = core.StringPtr("testString") + getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.GetReservation(getReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateDedicatedHostGroupOptions model with no property values - createDedicatedHostGroupOptionsModelNew := new(vpcv1.CreateDedicatedHostGroupOptions) + // Construct a second instance of the GetReservationOptions model with no property values + getReservationOptionsModelNew := new(vpcv1.GetReservationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModelNew) + result, response, operationErr = vpcService.GetReservation(getReservationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -37468,10 +38101,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateDedicatedHostGroup successfully`, func() { + It(`Invoke GetReservation successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37480,25 +38113,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetReservationOptions model + getReservationOptionsModel := new(vpcv1.GetReservationOptions) + getReservationOptionsModel.ID = core.StringPtr("testString") + getReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.GetReservation(getReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -37510,24 +38131,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions)`, func() { + Describe(`UpdateReservation(updateReservationOptions *UpdateReservationOptions) - Operation response error`, func() { version := "2024-06-23" - deleteDedicatedHostGroupPath := "/dedicated_host/groups/testString" - Context(`Using mock server endpoint`, func() { + updateReservationPath := "/reservations/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("DELETE")) - + Expect(req.URL.EscapedPath()).To(Equal(updateReservationPath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteDedicatedHostGroup successfully`, func() { + It(`Invoke UpdateReservation with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37536,72 +38158,92 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteDedicatedHostGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the ReservationCapacityPatch model + reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) + reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) - // Construct an instance of the DeleteDedicatedHostGroupOptions model - deleteDedicatedHostGroupOptionsModel := new(vpcv1.DeleteDedicatedHostGroupOptions) - deleteDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - deleteDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReservationCommittedUsePatch model + reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) + reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePatchModel.Term = core.StringPtr("testString") - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteDedicatedHostGroup with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the ReservationProfilePatch model + reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) + reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") - // Construct an instance of the DeleteDedicatedHostGroupOptions model - deleteDedicatedHostGroupOptionsModel := new(vpcv1.DeleteDedicatedHostGroupOptions) - deleteDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - deleteDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModel) + // Construct an instance of the ReservationPatch model + reservationPatchModel := new(vpcv1.ReservationPatch) + reservationPatchModel.Capacity = reservationCapacityPatchModel + reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel + reservationPatchModel.Name = core.StringPtr("my-reservation") + reservationPatchModel.Profile = reservationProfilePatchModel + reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateReservationOptions model + updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) + updateReservationOptionsModel.ID = core.StringPtr("testString") + updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch + updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateReservation(updateReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteDedicatedHostGroupOptions model with no property values - deleteDedicatedHostGroupOptionsModelNew := new(vpcv1.DeleteDedicatedHostGroupOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModelNew) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateReservation(updateReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) - Operation response error`, func() { + Describe(`UpdateReservation(updateReservationOptions *UpdateReservationOptions)`, func() { version := "2024-06-23" - getDedicatedHostGroupPath := "/dedicated_host/groups/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + updateReservationPath := "/reservations/testString" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateReservationPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetDedicatedHostGroup with error: Operation response processing error`, func() { + It(`Invoke UpdateReservation successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37609,77 +38251,47 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions)`, func() { - version := "2024-06-23" - getDedicatedHostGroupPath := "/dedicated_host/groups/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("GET")) + // Construct an instance of the ReservationCapacityPatch model + reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) + reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) + // Construct an instance of the ReservationCommittedUsePatch model + reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) + reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePatchModel.Term = core.StringPtr("testString") - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke GetDedicatedHostGroup successfully with retries`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) + // Construct an instance of the ReservationProfilePatch model + reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) + reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReservationPatch model + reservationPatchModel := new(vpcv1.ReservationPatch) + reservationPatchModel.Capacity = reservationCapacityPatchModel + reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel + reservationPatchModel.Name = core.StringPtr("my-reservation") + reservationPatchModel.Profile = reservationProfilePatchModel + reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateReservationOptions model + updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) + updateReservationOptionsModel.ID = core.StringPtr("testString") + updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch + updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) + _, _, operationErr := vpcService.UpdateReservationWithContext(ctx, updateReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.UpdateReservation(updateReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -37687,7 +38299,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) + _, _, operationErr = vpcService.UpdateReservationWithContext(ctx, updateReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -37701,18 +38313,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateReservationPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"affinity_policy": "restricted", "capacity": {"allocated": 10, "available": 8, "status": "allocated", "total": 10, "used": 2}, "committed_use": {"expiration_at": "2019-01-01T12:00:00.000Z", "expiration_policy": "release", "term": "Term"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "href": "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "id": "0717-ba49df72-37b8-43ac-98da-f8e029de0e63", "lifecycle_state": "stable", "name": "my-reservation", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "reservation", "status": "activating", "status_reasons": [{"code": "cannot_activate_no_capacity_available", "message": "The reservation cannot be activated because capacity is unavailable", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetDedicatedHostGroup successfully`, func() { + It(`Invoke UpdateReservation successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37722,24 +38350,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetDedicatedHostGroup(nil) + result, response, operationErr := vpcService.UpdateReservation(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReservationCapacityPatch model + reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) + reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) + + // Construct an instance of the ReservationCommittedUsePatch model + reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) + reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePatchModel.Term = core.StringPtr("testString") + + // Construct an instance of the ReservationProfilePatch model + reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) + reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") + + // Construct an instance of the ReservationPatch model + reservationPatchModel := new(vpcv1.ReservationPatch) + reservationPatchModel.Capacity = reservationCapacityPatchModel + reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel + reservationPatchModel.Name = core.StringPtr("my-reservation") + reservationPatchModel.Profile = reservationProfilePatchModel + reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateReservationOptions model + updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) + updateReservationOptionsModel.ID = core.StringPtr("testString") + updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch + updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.UpdateReservation(updateReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetDedicatedHostGroup with error: Operation validation and request error`, func() { + It(`Invoke UpdateReservation with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37748,22 +38400,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReservationCapacityPatch model + reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) + reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) + + // Construct an instance of the ReservationCommittedUsePatch model + reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) + reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePatchModel.Term = core.StringPtr("testString") + + // Construct an instance of the ReservationProfilePatch model + reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) + reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") + + // Construct an instance of the ReservationPatch model + reservationPatchModel := new(vpcv1.ReservationPatch) + reservationPatchModel.Capacity = reservationCapacityPatchModel + reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel + reservationPatchModel.Name = core.StringPtr("my-reservation") + reservationPatchModel.Profile = reservationProfilePatchModel + reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateReservationOptions model + updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) + updateReservationOptionsModel.ID = core.StringPtr("testString") + updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch + updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.UpdateReservation(updateReservationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetDedicatedHostGroupOptions model with no property values - getDedicatedHostGroupOptionsModelNew := new(vpcv1.GetDedicatedHostGroupOptions) + // Construct a second instance of the UpdateReservationOptions model with no property values + updateReservationOptionsModelNew := new(vpcv1.UpdateReservationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModelNew) + result, response, operationErr = vpcService.UpdateReservation(updateReservationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -37781,7 +38457,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetDedicatedHostGroup successfully`, func() { + It(`Invoke UpdateReservation successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37790,13 +38466,37 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReservationCapacityPatch model + reservationCapacityPatchModel := new(vpcv1.ReservationCapacityPatch) + reservationCapacityPatchModel.Total = core.Int64Ptr(int64(10)) + + // Construct an instance of the ReservationCommittedUsePatch model + reservationCommittedUsePatchModel := new(vpcv1.ReservationCommittedUsePatch) + reservationCommittedUsePatchModel.ExpirationPolicy = core.StringPtr("release") + reservationCommittedUsePatchModel.Term = core.StringPtr("testString") + + // Construct an instance of the ReservationProfilePatch model + reservationProfilePatchModel := new(vpcv1.ReservationProfilePatch) + reservationProfilePatchModel.Name = core.StringPtr("bx2-4x16") + reservationProfilePatchModel.ResourceType = core.StringPtr("instance_profile") + + // Construct an instance of the ReservationPatch model + reservationPatchModel := new(vpcv1.ReservationPatch) + reservationPatchModel.Capacity = reservationCapacityPatchModel + reservationPatchModel.CommittedUse = reservationCommittedUsePatchModel + reservationPatchModel.Name = core.StringPtr("my-reservation") + reservationPatchModel.Profile = reservationProfilePatchModel + reservationPatchModelAsPatch, asPatchErr := reservationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateReservationOptions model + updateReservationOptionsModel := new(vpcv1.UpdateReservationOptions) + updateReservationOptionsModel.ID = core.StringPtr("testString") + updateReservationOptionsModel.ReservationPatch = reservationPatchModelAsPatch + updateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.UpdateReservation(updateReservationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -37808,25 +38508,103 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) - Operation response error`, func() { + Describe(`ActivateReservation(activateReservationOptions *ActivateReservationOptions)`, func() { version := "2024-06-23" - updateDedicatedHostGroupPath := "/dedicated_host/groups/testString" + activateReservationPath := "/reservations/testString/activate" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(activateReservationPath)) + Expect(req.Method).To(Equal("POST")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke ActivateReservation successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.ActivateReservation(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the ActivateReservationOptions model + activateReservationOptionsModel := new(vpcv1.ActivateReservationOptions) + activateReservationOptionsModel.ID = core.StringPtr("testString") + activateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.ActivateReservation(activateReservationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke ActivateReservation with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ActivateReservationOptions model + activateReservationOptionsModel := new(vpcv1.ActivateReservationOptions) + activateReservationOptionsModel.ID = core.StringPtr("testString") + activateReservationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.ActivateReservation(activateReservationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the ActivateReservationOptions model with no property values + activateReservationOptionsModelNew := new(vpcv1.ActivateReservationOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.ActivateReservation(activateReservationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) - Operation response error`, func() { + version := "2024-06-23" + listDedicatedHostGroupsPath := "/dedicated_host/groups" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateDedicatedHostGroup with error: Operation response processing error`, func() { + It(`Invoke ListDedicatedHostGroups with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37835,26 +38613,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -37864,46 +38639,35 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions)`, func() { + Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions)`, func() { version := "2024-06-23" - updateDedicatedHostGroupPath := "/dedicated_host/groups/testString" + listDedicatedHostGroupsPath := "/dedicated_host/groups" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke UpdateDedicatedHostGroup successfully with retries`, func() { + It(`Invoke ListDedicatedHostGroups successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37913,28 +38677,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) + _, _, operationErr := vpcService.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -37942,7 +38703,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) + _, _, operationErr = vpcService.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -37956,34 +38717,23 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "groups": [{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke UpdateDedicatedHostGroup successfully`, func() { + It(`Invoke ListDedicatedHostGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37993,31 +38743,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(nil) + result, response, operationErr := vpcService.ListDedicatedHostGroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateDedicatedHostGroup with error: Operation validation and request error`, func() { + It(`Invoke ListDedicatedHostGroups with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38026,32 +38773,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateDedicatedHostGroupOptions model with no property values - updateDedicatedHostGroupOptionsModelNew := new(vpcv1.UpdateDedicatedHostGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -38066,7 +38803,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateDedicatedHostGroup successfully`, func() { + It(`Invoke ListDedicatedHostGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38075,20 +38812,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -38099,28 +38833,133 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) - Operation response error`, func() { - version := "2024-06-23" - listDedicatedHostProfilesPath := "/dedicated_host/profiles" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.DedicatedHostGroupCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.DedicatedHostGroupCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.DedicatedHostGroupCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + + // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"groups":[{"class":"bx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use DedicatedHostGroupsPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listDedicatedHostGroupsOptionsModel := &vpcv1.ListDedicatedHostGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + Name: core.StringPtr("my-name"), + } + + pager, err := vpcService.NewDedicatedHostGroupsPager(listDedicatedHostGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.DedicatedHostGroup + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use DedicatedHostGroupsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listDedicatedHostGroupsOptionsModel := &vpcv1.ListDedicatedHostGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + Name: core.StringPtr("my-name"), + } + + pager, err := vpcService.NewDedicatedHostGroupsPager(listDedicatedHostGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) - Operation response error`, func() { + version := "2024-06-23" + createDedicatedHostGroupPath := "/dedicated_host/groups" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDedicatedHostProfiles with error: Operation response processing error`, func() { + It(`Invoke CreateDedicatedHostGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38129,20 +38968,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -38152,32 +39002,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions)`, func() { + Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions)`, func() { version := "2024-06-23" - listDedicatedHostProfilesPath := "/dedicated_host/profiles" + createDedicatedHostGroupPath := "/dedicated_host/groups" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?start=9da91&limit=20"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListDedicatedHostProfiles successfully with retries`, func() { + It(`Invoke CreateDedicatedHostGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38187,22 +39051,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) + _, _, operationErr := vpcService.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -38210,7 +39085,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) + _, _, operationErr = vpcService.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -38224,20 +39099,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?start=9da91&limit=20"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListDedicatedHostProfiles successfully`, func() { + It(`Invoke CreateDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38247,25 +39136,36 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListDedicatedHostProfiles(nil) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDedicatedHostProfiles with error: Operation request error`, func() { + It(`Invoke CreateDedicatedHostGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38274,19 +39174,37 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the CreateDedicatedHostGroupOptions model with no property values + createDedicatedHostGroupOptionsModelNew := new(vpcv1.CreateDedicatedHostGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -38298,10 +39216,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListDedicatedHostProfiles successfully`, func() { + It(`Invoke CreateDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38310,14 +39228,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -38328,59 +39257,25 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.DedicatedHostProfileCollection) - nextObject := new(vpcv1.DedicatedHostProfileCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.DedicatedHostProfileCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.DedicatedHostProfileCollection) - nextObject := new(vpcv1.DedicatedHostProfileCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions)`, func() { + version := "2024-06-23" + deleteDedicatedHostGroupPath := "/dedicated_host/groups/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("DELETE")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}`) - } else { - res.WriteHeader(400) - } + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) })) }) - It(`Use DedicatedHostProfilesPager.GetNext successfully`, func() { + It(`Invoke DeleteDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38389,24 +39284,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listDedicatedHostProfilesOptionsModel := &vpcv1.ListDedicatedHostProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteDedicatedHostGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - pager, err := vpcService.NewDedicatedHostProfilesPager(listDedicatedHostProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the DeleteDedicatedHostGroupOptions model + deleteDedicatedHostGroupOptionsModel := new(vpcv1.DeleteDedicatedHostGroupOptions) + deleteDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + deleteDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - var allResults []vpcv1.DedicatedHostProfile - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) }) - It(`Use DedicatedHostProfilesPager.GetAll successfully`, func() { + It(`Invoke DeleteDedicatedHostGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38415,31 +39308,39 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listDedicatedHostProfilesOptionsModel := &vpcv1.ListDedicatedHostProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewDedicatedHostProfilesPager(listDedicatedHostProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() + // Construct an instance of the DeleteDedicatedHostGroupOptions model + deleteDedicatedHostGroupOptionsModel := new(vpcv1.DeleteDedicatedHostGroupOptions) + deleteDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + deleteDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + response, operationErr := vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteDedicatedHostGroupOptions model with no property values + deleteDedicatedHostGroupOptionsModelNew := new(vpcv1.DeleteDedicatedHostGroupOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) - Operation response error`, func() { + Describe(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) - Operation response error`, func() { version := "2024-06-23" - getDedicatedHostProfilePath := "/dedicated_host/profiles/mx2-host-152x1216" + getDedicatedHostGroupPath := "/dedicated_host/groups/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -38448,7 +39349,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetDedicatedHostProfile with error: Operation response processing error`, func() { + It(`Invoke GetDedicatedHostGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38457,19 +39358,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -38479,16 +39380,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions)`, func() { + Describe(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions)`, func() { version := "2024-06-23" - getDedicatedHostProfilePath := "/dedicated_host/profiles/mx2-host-152x1216" + getDedicatedHostGroupPath := "/dedicated_host/groups/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -38499,10 +39400,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}`) + fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetDedicatedHostProfile successfully with retries`, func() { + It(`Invoke GetDedicatedHostGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38512,21 +39413,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) + _, _, operationErr := vpcService.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -38534,7 +39435,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) + _, _, operationErr = vpcService.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -38548,7 +39449,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -38556,10 +39457,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}`) + fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetDedicatedHostProfile successfully`, func() { + It(`Invoke GetDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38569,24 +39470,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetDedicatedHostProfile(nil) + result, response, operationErr := vpcService.GetDedicatedHostGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetDedicatedHostProfile with error: Operation validation and request error`, func() { + It(`Invoke GetDedicatedHostGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38595,22 +39496,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetDedicatedHostProfileOptions model with no property values - getDedicatedHostProfileOptionsModelNew := new(vpcv1.GetDedicatedHostProfileOptions) + // Construct a second instance of the GetDedicatedHostGroupOptions model with no property values + getDedicatedHostGroupOptionsModelNew := new(vpcv1.GetDedicatedHostGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModelNew) + result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -38628,7 +39529,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetDedicatedHostProfile successfully`, func() { + It(`Invoke GetDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38637,13 +39538,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -38655,31 +39556,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) - Operation response error`, func() { + Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) - Operation response error`, func() { version := "2024-06-23" - listDedicatedHostsPath := "/dedicated_hosts" + updateDedicatedHostGroupPath := "/dedicated_host/groups/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDedicatedHosts with error: Operation response processing error`, func() { + It(`Invoke UpdateDedicatedHostGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38688,24 +39583,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-dedicated-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -38715,36 +39612,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions)`, func() { + Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions)`, func() { version := "2024-06-23" - listDedicatedHostsPath := "/dedicated_hosts" + updateDedicatedHostGroupPath := "/dedicated_host/groups/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListDedicatedHosts successfully with retries`, func() { + It(`Invoke UpdateDedicatedHostGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38754,26 +39661,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-dedicated-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) + _, _, operationErr := vpcService.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -38781,7 +39690,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) + _, _, operationErr = vpcService.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -38795,24 +39704,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"class": "bx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListDedicatedHosts successfully`, func() { + It(`Invoke UpdateDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38822,29 +39741,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListDedicatedHosts(nil) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-dedicated-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDedicatedHosts with error: Operation request error`, func() { + It(`Invoke UpdateDedicatedHostGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38853,23 +39774,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-dedicated-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the UpdateDedicatedHostGroupOptions model with no property values + updateDedicatedHostGroupOptionsModelNew := new(vpcv1.UpdateDedicatedHostGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -38884,7 +39814,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListDedicatedHosts successfully`, func() { + It(`Invoke UpdateDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38893,18 +39823,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-dedicated-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -38915,135 +39847,28 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.DedicatedHostCollection) - nextObject := new(vpcv1.DedicatedHostCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.DedicatedHostCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.DedicatedHostCollection) - nextObject := new(vpcv1.DedicatedHostCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a","id":"0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a","id":"0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use DedicatedHostsPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listDedicatedHostsOptionsModel := &vpcv1.ListDedicatedHostsOptions{ - DedicatedHostGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), - Name: core.StringPtr("my-name"), - } - - pager, err := vpcService.NewDedicatedHostsPager(listDedicatedHostsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.DedicatedHost - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use DedicatedHostsPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listDedicatedHostsOptionsModel := &vpcv1.ListDedicatedHostsOptions{ - DedicatedHostGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), - Name: core.StringPtr("my-name"), - } - - pager, err := vpcService.NewDedicatedHostsPager(listDedicatedHostsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) - Operation response error`, func() { + Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) - Operation response error`, func() { version := "2024-06-23" - createDedicatedHostPath := "/dedicated_hosts" + listDedicatedHostProfilesPath := "/dedicated_host/profiles" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateDedicatedHost with error: Operation response processing error`, func() { + It(`Invoke ListDedicatedHostProfiles with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39052,39 +39877,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel - - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -39094,46 +39900,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions)`, func() { + Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions)`, func() { version := "2024-06-23" - createDedicatedHostPath := "/dedicated_hosts" + listDedicatedHostProfilesPath := "/dedicated_host/profiles" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}`) })) }) - It(`Invoke CreateDedicatedHost successfully with retries`, func() { + It(`Invoke ListDedicatedHostProfiles successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39143,41 +39935,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel - - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) + _, _, operationErr := vpcService.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -39185,7 +39958,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) + _, _, operationErr = vpcService.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -39199,34 +39972,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}`) })) }) - It(`Invoke CreateDedicatedHost successfully`, func() { + It(`Invoke ListDedicatedHostProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39236,44 +39995,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateDedicatedHost(nil) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel - - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateDedicatedHost with error: Operation validation and request error`, func() { + It(`Invoke ListDedicatedHostProfiles with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39282,45 +40022,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel - - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateDedicatedHostOptions model with no property values - createDedicatedHostOptionsModelNew := new(vpcv1.CreateDedicatedHostOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -39332,10 +40046,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateDedicatedHost successfully`, func() { + It(`Invoke ListDedicatedHostProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39344,33 +40058,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel - - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -39381,17 +40076,118 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.DedicatedHostProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.DedicatedHostProfileCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.DedicatedHostProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"class":"bx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use DedicatedHostProfilesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listDedicatedHostProfilesOptionsModel := &vpcv1.ListDedicatedHostProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewDedicatedHostProfilesPager(listDedicatedHostProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.DedicatedHostProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use DedicatedHostProfilesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listDedicatedHostProfilesOptionsModel := &vpcv1.ListDedicatedHostProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewDedicatedHostProfilesPager(listDedicatedHostProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) - Operation response error`, func() { + Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) - Operation response error`, func() { version := "2024-06-23" - listDedicatedHostDisksPath := "/dedicated_hosts/testString/disks" + getDedicatedHostProfilePath := "/dedicated_host/profiles/mx2-host-152x1216" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -39400,7 +40196,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDedicatedHostDisks with error: Operation response processing error`, func() { + It(`Invoke GetDedicatedHostProfile with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39409,19 +40205,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -39431,16 +40227,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions)`, func() { + Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions)`, func() { version := "2024-06-23" - listDedicatedHostDisksPath := "/dedicated_hosts/testString/disks" + getDedicatedHostProfilePath := "/dedicated_host/profiles/mx2-host-152x1216" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -39451,10 +40247,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}`) + fmt.Fprintf(res, "%s", `{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}`) })) }) - It(`Invoke ListDedicatedHostDisks successfully with retries`, func() { + It(`Invoke GetDedicatedHostProfile successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39464,21 +40260,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) + _, _, operationErr := vpcService.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -39486,7 +40282,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) + _, _, operationErr = vpcService.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -39500,7 +40296,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -39508,10 +40304,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}`) + fmt.Fprintf(res, "%s", `{"class": "bx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}`) })) }) - It(`Invoke ListDedicatedHostDisks successfully`, func() { + It(`Invoke GetDedicatedHostProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39521,24 +40317,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListDedicatedHostDisks(nil) + result, response, operationErr := vpcService.GetDedicatedHostProfile(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDedicatedHostDisks with error: Operation validation and request error`, func() { + It(`Invoke GetDedicatedHostProfile with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39547,22 +40343,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListDedicatedHostDisksOptions model with no property values - listDedicatedHostDisksOptionsModelNew := new(vpcv1.ListDedicatedHostDisksOptions) + // Construct a second instance of the GetDedicatedHostProfileOptions model with no property values + getDedicatedHostProfileOptionsModelNew := new(vpcv1.GetDedicatedHostProfileOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModelNew) + result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -39580,7 +40376,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListDedicatedHostDisks successfully`, func() { + It(`Invoke GetDedicatedHostProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39589,13 +40385,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("mx2-host-152x1216") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -39607,25 +40403,31 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) - Operation response error`, func() { + Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) - Operation response error`, func() { version := "2024-06-23" - getDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" + listDedicatedHostsPath := "/dedicated_hosts" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetDedicatedHostDisk with error: Operation response processing error`, func() { + It(`Invoke ListDedicatedHosts with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39634,20 +40436,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -39657,30 +40463,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions)`, func() { + Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions)`, func() { version := "2024-06-23" - getDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" + listDedicatedHostsPath := "/dedicated_hosts" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) + fmt.Fprintf(res, "%s", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke GetDedicatedHostDisk successfully with retries`, func() { + It(`Invoke ListDedicatedHosts successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39690,22 +40502,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) + _, _, operationErr := vpcService.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -39713,7 +40529,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) + _, _, operationErr = vpcService.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -39727,18 +40543,24 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) + fmt.Fprintf(res, "%s", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke GetDedicatedHostDisk successfully`, func() { + It(`Invoke ListDedicatedHosts successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39748,25 +40570,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetDedicatedHostDisk(nil) + result, response, operationErr := vpcService.ListDedicatedHosts(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetDedicatedHostDisk with error: Operation validation and request error`, func() { + It(`Invoke ListDedicatedHosts with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39775,26 +40601,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetDedicatedHostDiskOptions model with no property values - getDedicatedHostDiskOptionsModelNew := new(vpcv1.GetDedicatedHostDiskOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -39809,7 +40632,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetDedicatedHostDisk successfully`, func() { + It(`Invoke ListDedicatedHosts successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39818,14 +40641,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("my-name") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -39836,26 +40663,135 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.DedicatedHostCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.DedicatedHostCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.DedicatedHostCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e","id":"0717-bd091a9e-b036-4c65-a79b-56d164911f6e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-dedicated-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","id":"0717-1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use DedicatedHostsPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listDedicatedHostsOptionsModel := &vpcv1.ListDedicatedHostsOptions{ + DedicatedHostGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + Name: core.StringPtr("my-name"), + } + + pager, err := vpcService.NewDedicatedHostsPager(listDedicatedHostsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.DedicatedHost + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use DedicatedHostsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listDedicatedHostsOptionsModel := &vpcv1.ListDedicatedHostsOptions{ + DedicatedHostGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + Name: core.StringPtr("my-name"), + } + + pager, err := vpcService.NewDedicatedHostsPager(listDedicatedHostsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) - Operation response error`, func() { + Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) - Operation response error`, func() { version := "2024-06-23" - updateDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" + createDedicatedHostPath := "/dedicated_hosts" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateDedicatedHostDisk with error: Operation response processing error`, func() { + It(`Invoke CreateDedicatedHost with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39864,27 +40800,39 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -39894,17 +40842,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions)`, func() { + Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions)`, func() { version := "2024-06-23" - updateDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" + createDedicatedHostPath := "/dedicated_hosts" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -39929,11 +40877,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateDedicatedHostDisk successfully with retries`, func() { + It(`Invoke CreateDedicatedHost successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39943,29 +40891,41 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) + _, _, operationErr := vpcService.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -39973,7 +40933,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) + _, _, operationErr = vpcService.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -39987,8 +40947,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -40010,11 +40970,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateDedicatedHostDisk successfully`, func() { + It(`Invoke CreateDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40024,32 +40984,44 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateDedicatedHostDisk(nil) + result, response, operationErr := vpcService.CreateDedicatedHost(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateDedicatedHostDisk with error: Operation validation and request error`, func() { + It(`Invoke CreateDedicatedHost with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40058,30 +41030,42 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateDedicatedHostDiskOptions model with no property values - updateDedicatedHostDiskOptionsModelNew := new(vpcv1.UpdateDedicatedHostDiskOptions) + // Construct a second instance of the CreateDedicatedHostOptions model with no property values + createDedicatedHostOptionsModelNew := new(vpcv1.CreateDedicatedHostOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModelNew) + result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -40096,10 +41080,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateDedicatedHostDisk successfully`, func() { + It(`Invoke CreateDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40108,115 +41092,54 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions)`, func() { - version := "2024-06-23" - deleteDedicatedHostPath := "/dedicated_hosts/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteDedicatedHostPath)) - Expect(req.Method).To(Equal("DELETE")) + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteDedicatedHost successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteDedicatedHost(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel - // Construct an instance of the DeleteDedicatedHostOptions model - deleteDedicatedHostOptionsModel := new(vpcv1.DeleteDedicatedHostOptions) - deleteDedicatedHostOptionsModel.ID = core.StringPtr("testString") - deleteDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) + // Invoke operation + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteDedicatedHost with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteDedicatedHostOptions model - deleteDedicatedHostOptionsModel := new(vpcv1.DeleteDedicatedHostOptions) - deleteDedicatedHostOptionsModel.ID = core.StringPtr("testString") - deleteDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteDedicatedHostOptions model with no property values - deleteDedicatedHostOptionsModelNew := new(vpcv1.DeleteDedicatedHostOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) - Operation response error`, func() { + Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) - Operation response error`, func() { version := "2024-06-23" - getDedicatedHostPath := "/dedicated_hosts/testString" + listDedicatedHostDisksPath := "/dedicated_hosts/testString/disks" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -40225,7 +41148,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetDedicatedHost with error: Operation response processing error`, func() { + It(`Invoke ListDedicatedHostDisks with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40234,19 +41157,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -40256,16 +41179,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions)`, func() { + Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions)`, func() { version := "2024-06-23" - getDedicatedHostPath := "/dedicated_hosts/testString" + listDedicatedHostDisksPath := "/dedicated_hosts/testString/disks" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -40276,10 +41199,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}`) })) }) - It(`Invoke GetDedicatedHost successfully with retries`, func() { + It(`Invoke ListDedicatedHostDisks successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40289,21 +41212,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) + _, _, operationErr := vpcService.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -40311,7 +41234,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) + _, _, operationErr = vpcService.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -40325,7 +41248,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -40333,10 +41256,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}`) })) }) - It(`Invoke GetDedicatedHost successfully`, func() { + It(`Invoke ListDedicatedHostDisks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40346,24 +41269,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetDedicatedHost(nil) + result, response, operationErr := vpcService.ListDedicatedHostDisks(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetDedicatedHost with error: Operation validation and request error`, func() { + It(`Invoke ListDedicatedHostDisks with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40372,22 +41295,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetDedicatedHostOptions model with no property values - getDedicatedHostOptionsModelNew := new(vpcv1.GetDedicatedHostOptions) + // Construct a second instance of the ListDedicatedHostDisksOptions model with no property values + listDedicatedHostDisksOptionsModelNew := new(vpcv1.ListDedicatedHostDisksOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModelNew) + result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -40405,7 +41328,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetDedicatedHost successfully`, func() { + It(`Invoke ListDedicatedHostDisks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40414,13 +41337,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -40432,17 +41355,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) - Operation response error`, func() { + Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) - Operation response error`, func() { version := "2024-06-23" - updateDedicatedHostPath := "/dedicated_hosts/testString" + getDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -40450,7 +41373,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateDedicatedHost with error: Operation response processing error`, func() { + It(`Invoke GetDedicatedHostDisk with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40459,27 +41382,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -40489,33 +41405,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions)`, func() { + Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions)`, func() { version := "2024-06-23" - updateDedicatedHostPath := "/dedicated_hosts/testString" + getDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -40525,10 +41425,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) })) }) - It(`Invoke UpdateDedicatedHost successfully with retries`, func() { + It(`Invoke GetDedicatedHostDisk successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40538,29 +41438,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) + _, _, operationErr := vpcService.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -40568,7 +41461,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) + _, _, operationErr = vpcService.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -40582,34 +41475,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) })) }) - It(`Invoke UpdateDedicatedHost successfully`, func() { + It(`Invoke GetDedicatedHostDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40619,32 +41496,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateDedicatedHost(nil) + result, response, operationErr := vpcService.GetDedicatedHostDisk(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateDedicatedHost with error: Operation validation and request error`, func() { + It(`Invoke GetDedicatedHostDisk with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40653,30 +41523,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateDedicatedHostOptions model with no property values - updateDedicatedHostOptionsModelNew := new(vpcv1.UpdateDedicatedHostOptions) + // Construct a second instance of the GetDedicatedHostDiskOptions model with no property values + getDedicatedHostDiskOptionsModelNew := new(vpcv1.GetDedicatedHostDiskOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModelNew) + result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -40694,7 +41557,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateDedicatedHost successfully`, func() { + It(`Invoke GetDedicatedHostDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40703,21 +41566,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -40729,27 +41585,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) - Operation response error`, func() { + Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) - Operation response error`, func() { version := "2024-06-23" - listPlacementGroupsPath := "/placement_groups" + updateDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListPlacementGroups with error: Operation response processing error`, func() { + It(`Invoke UpdateDedicatedHostDisk with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40758,20 +41612,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-dedicated-host-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -40781,32 +41642,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions)`, func() { + Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions)`, func() { version := "2024-06-23" - listPlacementGroupsPath := "/placement_groups" + updateDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) })) }) - It(`Invoke ListPlacementGroups successfully with retries`, func() { + It(`Invoke UpdateDedicatedHostDisk successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40816,22 +41691,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-dedicated-host-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) + _, _, operationErr := vpcService.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -40839,7 +41721,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) + _, _, operationErr = vpcService.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -40853,20 +41735,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) })) }) - It(`Invoke ListPlacementGroups successfully`, func() { + It(`Invoke UpdateDedicatedHostDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40876,25 +41772,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListPlacementGroups(nil) + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-dedicated-host-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListPlacementGroups with error: Operation request error`, func() { + It(`Invoke UpdateDedicatedHostDisk with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40903,19 +41806,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-dedicated-host-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the UpdateDedicatedHostDiskOptions model with no property values + updateDedicatedHostDiskOptionsModelNew := new(vpcv1.UpdateDedicatedHostDiskOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -40930,7 +41847,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListPlacementGroups successfully`, func() { + It(`Invoke UpdateDedicatedHostDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40939,14 +41856,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-dedicated-host-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -40957,59 +41881,25 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.PlacementGroupCollection) - nextObject := new(vpcv1.PlacementGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.PlacementGroupCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.PlacementGroupCollection) - nextObject := new(vpcv1.PlacementGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions)`, func() { + version := "2024-06-23" + deleteDedicatedHostPath := "/dedicated_hosts/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteDedicatedHostPath)) + Expect(req.Method).To(Equal("DELETE")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r018-418fe842-a3e9-47b9-a938-1aa5bd632871","lifecycle_state":"stable","name":"my-placement-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"placement_group","strategy":"host_spread"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r018-418fe842-a3e9-47b9-a938-1aa5bd632871","lifecycle_state":"stable","name":"my-placement-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"placement_group","strategy":"host_spread"}]}`) - } else { - res.WriteHeader(400) - } + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) })) }) - It(`Use PlacementGroupsPager.GetNext successfully`, func() { + It(`Invoke DeleteDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41018,24 +41908,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteDedicatedHost(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the DeleteDedicatedHostOptions model + deleteDedicatedHostOptionsModel := new(vpcv1.DeleteDedicatedHostOptions) + deleteDedicatedHostOptionsModel.ID = core.StringPtr("testString") + deleteDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - var allResults []vpcv1.PlacementGroup - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) }) - It(`Use PlacementGroupsPager.GetAll successfully`, func() { + It(`Invoke DeleteDedicatedHost with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41044,40 +41932,48 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() + // Construct an instance of the DeleteDedicatedHostOptions model + deleteDedicatedHostOptionsModel := new(vpcv1.DeleteDedicatedHostOptions) + deleteDedicatedHostOptionsModel.ID = core.StringPtr("testString") + deleteDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + response, operationErr := vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteDedicatedHostOptions model with no property values + deleteDedicatedHostOptionsModelNew := new(vpcv1.DeleteDedicatedHostOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) - Operation response error`, func() { + Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) - Operation response error`, func() { version := "2024-06-23" - createPlacementGroupPath := "/placement_groups" + getDedicatedHostPath := "/dedicated_hosts/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreatePlacementGroup with error: Operation response processing error`, func() { + It(`Invoke GetDedicatedHost with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41086,25 +41982,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -41114,33 +42004,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions)`, func() { + Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions)`, func() { version := "2024-06-23" - createPlacementGroupPath := "/placement_groups" + getDedicatedHostPath := "/dedicated_hosts/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -41149,11 +42023,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreatePlacementGroup successfully with retries`, func() { + It(`Invoke GetDedicatedHost successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41163,27 +42037,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) + _, _, operationErr := vpcService.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -41191,7 +42059,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) + _, _, operationErr = vpcService.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -41205,34 +42073,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreatePlacementGroup successfully`, func() { + It(`Invoke GetDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41242,30 +42094,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreatePlacementGroup(nil) + result, response, operationErr := vpcService.GetDedicatedHost(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreatePlacementGroup with error: Operation validation and request error`, func() { + It(`Invoke GetDedicatedHost with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41274,28 +42120,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreatePlacementGroupOptions model with no property values - createPlacementGroupOptionsModelNew := new(vpcv1.CreatePlacementGroupOptions) + // Construct a second instance of the GetDedicatedHostOptions model with no property values + getDedicatedHostOptionsModelNew := new(vpcv1.GetDedicatedHostOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModelNew) + result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -41310,10 +42150,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreatePlacementGroup successfully`, func() { + It(`Invoke GetDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41322,19 +42162,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -41346,24 +42180,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions)`, func() { + Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) - Operation response error`, func() { version := "2024-06-23" - deletePlacementGroupPath := "/placement_groups/testString" - Context(`Using mock server endpoint`, func() { + updateDedicatedHostPath := "/dedicated_hosts/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deletePlacementGroupPath)) - Expect(req.Method).To(Equal("DELETE")) - + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeletePlacementGroup successfully`, func() { + It(`Invoke UpdateDedicatedHost with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41372,344 +42207,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeletePlacementGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeletePlacementGroupOptions model - deletePlacementGroupOptionsModel := new(vpcv1.DeletePlacementGroupOptions) - deletePlacementGroupOptionsModel.ID = core.StringPtr("testString") - deletePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(false) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeletePlacementGroup with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the DeletePlacementGroupOptions model - deletePlacementGroupOptionsModel := new(vpcv1.DeletePlacementGroupOptions) - deletePlacementGroupOptionsModel.ID = core.StringPtr("testString") - deletePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeletePlacementGroupOptions model with no property values - deletePlacementGroupOptionsModelNew := new(vpcv1.DeletePlacementGroupOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModelNew) + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) - Operation response error`, func() { + Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions)`, func() { version := "2024-06-23" - getPlacementGroupPath := "/placement_groups/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + updateDedicatedHostPath := "/dedicated_hosts/testString" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke GetPlacementGroup with error: Operation response processing error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions)`, func() { - version := "2024-06-23" - getPlacementGroupPath := "/placement_groups/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) - })) - }) - It(`Invoke GetPlacementGroup successfully with retries`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := vpcService.GetPlacementGroupWithContext(ctx, getPlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = vpcService.GetPlacementGroupWithContext(ctx, getPlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) - })) - }) - It(`Invoke GetPlacementGroup successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetPlacementGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetPlacementGroup with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the GetPlacementGroupOptions model with no property values - getPlacementGroupOptionsModelNew := new(vpcv1.GetPlacementGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke GetPlacementGroup successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) - Operation response error`, func() { - version := "2024-06-23" - updatePlacementGroupPath := "/placement_groups/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke UpdatePlacementGroup with error: Operation response processing error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions)`, func() { - version := "2024-06-23" - updatePlacementGroupPath := "/placement_groups/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -41736,10 +42273,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdatePlacementGroup successfully with retries`, func() { + It(`Invoke UpdateDedicatedHost successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41749,28 +42286,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(false) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) + _, _, operationErr := vpcService.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -41778,7 +42316,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) + _, _, operationErr = vpcService.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -41792,7 +42330,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -41816,10 +42354,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a/disks/0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "id": "0717-bd091a9e-b036-4c65-a79b-56d164911f6e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-dedicated-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/0717-1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdatePlacementGroup successfully`, func() { + It(`Invoke UpdateDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41829,31 +42367,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdatePlacementGroup(nil) + result, response, operationErr := vpcService.UpdateDedicatedHost(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(false) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdatePlacementGroup with error: Operation validation and request error`, func() { + It(`Invoke UpdateDedicatedHost with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41862,29 +42401,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(false) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdatePlacementGroupOptions model with no property values - updatePlacementGroupOptionsModelNew := new(vpcv1.UpdatePlacementGroupOptions) + // Construct a second instance of the UpdateDedicatedHostOptions model with no property values + updateDedicatedHostOptionsModelNew := new(vpcv1.UpdateDedicatedHostOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModelNew) + result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -41902,7 +42442,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdatePlacementGroup successfully`, func() { + It(`Invoke UpdateDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41911,20 +42451,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(false) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -41936,16 +42477,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) - Operation response error`, func() { + Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) - Operation response error`, func() { version := "2024-06-23" - listBareMetalServerProfilesPath := "/bare_metal_server/profiles" + listPlacementGroupsPath := "/placement_groups" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -41956,7 +42497,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerProfiles with error: Operation response processing error`, func() { + It(`Invoke ListPlacementGroups with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41965,20 +42506,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -41988,16 +42529,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions)`, func() { + Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions)`, func() { version := "2024-06-23" - listBareMetalServerProfilesPath := "/bare_metal_server/profiles" + listPlacementGroupsPath := "/placement_groups" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -42010,10 +42551,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}`) })) }) - It(`Invoke ListBareMetalServerProfiles successfully with retries`, func() { + It(`Invoke ListPlacementGroups successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42023,22 +42564,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBareMetalServerProfilesWithContext(ctx, listBareMetalServerProfilesOptionsModel) + _, _, operationErr := vpcService.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -42046,7 +42587,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerProfilesWithContext(ctx, listBareMetalServerProfilesOptionsModel) + _, _, operationErr = vpcService.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -42060,7 +42601,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -42070,10 +42611,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}`) })) }) - It(`Invoke ListBareMetalServerProfiles successfully`, func() { + It(`Invoke ListPlacementGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42083,25 +42624,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerProfiles(nil) + result, response, operationErr := vpcService.ListPlacementGroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerProfiles with error: Operation request error`, func() { + It(`Invoke ListPlacementGroups with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42110,15 +42651,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -42137,7 +42678,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerProfiles successfully`, func() { + It(`Invoke ListPlacementGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42146,14 +42687,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -42166,8 +42707,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BareMetalServerProfileCollection) - nextObject := new(vpcv1.BareMetalServerProfileCollectionNext) + responseObject := new(vpcv1.PlacementGroupCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -42176,15 +42717,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.BareMetalServerProfileCollection) + responseObject := new(vpcv1.PlacementGroupCollection) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.BareMetalServerProfileCollection) - nextObject := new(vpcv1.BareMetalServerProfileCollectionNext) + responseObject := new(vpcv1.PlacementGroupCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -42200,7 +42741,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -42208,15 +42749,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"default":"amd64","type":"fixed","value":"amd64"},"cpu_core_count":{"type":"fixed","value":80},"cpu_socket_count":{"type":"fixed","value":4},"disks":[{"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":100},"supported_interface_types":{"default":"fcp","type":"enum","values":["fcp"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","memory":{"type":"fixed","value":16},"name":"bx2-metal-192x768","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-418fe842-a3e9-47b9-a938-1aa5bd632871","lifecycle_state":"stable","name":"my-placement-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"placement_group","strategy":"host_spread"}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"default":"amd64","type":"fixed","value":"amd64"},"cpu_core_count":{"type":"fixed","value":80},"cpu_socket_count":{"type":"fixed","value":4},"disks":[{"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":100},"supported_interface_types":{"default":"fcp","type":"enum","values":["fcp"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","memory":{"type":"fixed","value":16},"name":"bx2-metal-192x768","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r006-418fe842-a3e9-47b9-a938-1aa5bd632871","lifecycle_state":"stable","name":"my-placement-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"placement_group","strategy":"host_spread"}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use BareMetalServerProfilesPager.GetNext successfully`, func() { + It(`Use PlacementGroupsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42225,15 +42766,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listBareMetalServerProfilesOptionsModel := &vpcv1.ListBareMetalServerProfilesOptions{ + listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewBareMetalServerProfilesPager(listBareMetalServerProfilesOptionsModel) + pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.BareMetalServerProfile + var allResults []vpcv1.PlacementGroup for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -42242,7 +42783,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use BareMetalServerProfilesPager.GetAll successfully`, func() { + It(`Use PlacementGroupsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42251,11 +42792,11 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listBareMetalServerProfilesOptionsModel := &vpcv1.ListBareMetalServerProfilesOptions{ + listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewBareMetalServerProfilesPager(listBareMetalServerProfilesOptionsModel) + pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -42266,25 +42807,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) - Operation response error`, func() { + Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) - Operation response error`, func() { version := "2024-06-23" - getBareMetalServerProfilePath := "/bare_metal_server/profiles/bx2-metal-192x768" + createPlacementGroupPath := "/placement_groups" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerProfile with error: Operation response processing error`, func() { + It(`Invoke CreatePlacementGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42293,19 +42834,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -42315,17 +42862,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions)`, func() { + Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions)`, func() { version := "2024-06-23" - getBareMetalServerProfilePath := "/bare_metal_server/profiles/bx2-metal-192x768" + createPlacementGroupPath := "/placement_groups" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -42334,11 +42897,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke GetBareMetalServerProfile successfully with retries`, func() { + It(`Invoke CreatePlacementGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42348,21 +42911,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerProfileWithContext(ctx, getBareMetalServerProfileOptionsModel) + _, _, operationErr := vpcService.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -42370,7 +42939,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerProfileWithContext(ctx, getBareMetalServerProfileOptionsModel) + _, _, operationErr = vpcService.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -42384,18 +42953,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke GetBareMetalServerProfile successfully`, func() { + It(`Invoke CreatePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42405,24 +42990,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerProfile(nil) + result, response, operationErr := vpcService.CreatePlacementGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerProfile with error: Operation validation and request error`, func() { + It(`Invoke CreatePlacementGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42431,22 +43022,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerProfileOptions model with no property values - getBareMetalServerProfileOptionsModelNew := new(vpcv1.GetBareMetalServerProfileOptions) + // Construct a second instance of the CreatePlacementGroupOptions model with no property values + createPlacementGroupOptionsModelNew := new(vpcv1.CreatePlacementGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModelNew) + result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -42461,10 +43058,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetBareMetalServerProfile successfully`, func() { + It(`Invoke CreatePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42473,13 +43070,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -42491,32 +43094,98 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) - Operation response error`, func() { + Describe(`DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions)`, func() { version := "2024-06-23" - listBareMetalServersPath := "/bare_metal_servers" + deletePlacementGroupPath := "/placement_groups/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deletePlacementGroupPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeletePlacementGroup successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeletePlacementGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeletePlacementGroupOptions model + deletePlacementGroupOptionsModel := new(vpcv1.DeletePlacementGroupOptions) + deletePlacementGroupOptionsModel.ID = core.StringPtr("testString") + deletePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeletePlacementGroup with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeletePlacementGroupOptions model + deletePlacementGroupOptionsModel := new(vpcv1.DeletePlacementGroupOptions) + deletePlacementGroupOptionsModel.ID = core.StringPtr("testString") + deletePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeletePlacementGroupOptions model with no property values + deletePlacementGroupOptionsModelNew := new(vpcv1.DeletePlacementGroupOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) - Operation response error`, func() { + version := "2024-06-23" + getPlacementGroupPath := "/placement_groups/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServers with error: Operation response processing error`, func() { + It(`Invoke GetPlacementGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42525,25 +43194,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -42553,37 +43216,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions)`, func() { + Describe(`GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions)`, func() { version := "2024-06-23" - listBareMetalServersPath := "/bare_metal_servers" + getPlacementGroupPath := "/placement_groups/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke ListBareMetalServers successfully with retries`, func() { + It(`Invoke GetPlacementGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42593,27 +43249,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBareMetalServersWithContext(ctx, listBareMetalServersOptionsModel) + _, _, operationErr := vpcService.GetPlacementGroupWithContext(ctx, getPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -42621,7 +43271,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServersWithContext(ctx, listBareMetalServersOptionsModel) + _, _, operationErr = vpcService.GetPlacementGroupWithContext(ctx, getPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -42635,25 +43285,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke ListBareMetalServers successfully`, func() { + It(`Invoke GetPlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42663,30 +43306,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServers(nil) + result, response, operationErr := vpcService.GetPlacementGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServers with error: Operation request error`, func() { + It(`Invoke GetPlacementGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42695,24 +43332,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the GetPlacementGroupOptions model with no property values + getPlacementGroupOptionsModelNew := new(vpcv1.GetPlacementGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -42727,7 +43365,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServers successfully`, func() { + It(`Invoke GetPlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42736,19 +43374,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -42759,59 +43391,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BareMetalServerCollection) - nextObject := new(vpcv1.BareMetalServerCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.BareMetalServerCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.BareMetalServerCollection) - nextObject := new(vpcv1.BareMetalServerCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) - Operation response error`, func() { + version := "2024-06-23" + updatePlacementGroupPath := "/placement_groups/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response + Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"bare_metal_servers":[{"bandwidth":20000,"boot_target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk"},"cpu":{"architecture":"amd64","core_count":80,"socket_count":4,"threads_per_core":2},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","name":"bx2-metal-192x768","resource_type":"bare_metal_server_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"bare_metal_server","status":"deleting","status_reasons":[{"code":"cannot_start_capacity","message":"The bare metal server cannot start as there is no more capacity in this\\nzone for a bare metal server with the requested profile.","more_info":"https://console.bluemix.net/docs/iaas/bare_metal_server.html"}],"trusted_platform_module":{"enabled":true,"mode":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"bare_metal_servers":[{"bandwidth":20000,"boot_target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk"},"cpu":{"architecture":"amd64","core_count":80,"socket_count":4,"threads_per_core":2},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","name":"bx2-metal-192x768","resource_type":"bare_metal_server_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"bare_metal_server","status":"deleting","status_reasons":[{"code":"cannot_start_capacity","message":"The bare metal server cannot start as there is no more capacity in this\\nzone for a bare metal server with the requested profile.","more_info":"https://console.bluemix.net/docs/iaas/bare_metal_server.html"}],"trusted_platform_module":{"enabled":true,"mode":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else { - res.WriteHeader(400) - } + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Use BareMetalServersPager.GetNext successfully`, func() { + It(`Invoke UpdatePlacementGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42820,215 +43419,49 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listBareMetalServersOptionsModel := &vpcv1.ListBareMetalServersOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"), - VPCName: core.StringPtr("my-vpc"), - } + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - pager, err := vpcService.NewBareMetalServersPager(listBareMetalServersOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - var allResults []vpcv1.BareMetalServer - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) - It(`Use BareMetalServersPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listBareMetalServersOptionsModel := &vpcv1.ListBareMetalServersOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"), - VPCName: core.StringPtr("my-vpc"), - } - - pager, err := vpcService.NewBareMetalServersPager(listBareMetalServersOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) - Operation response error`, func() { + Describe(`UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions)`, func() { version := "2024-06-23" - createBareMetalServerPath := "/bare_metal_servers" - Context(`Using mock server endpoint with invalid JSON response`, func() { + updatePlacementGroupPath := "/placement_groups/testString" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke CreateBareMetalServer with error: Operation response processing error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + Expect(req.Method).To(Equal("PATCH")) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model - bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model - bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) - bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel - bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel - bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - bareMetalServerPrototypeModel.VPC = vpcIdentityModel - bareMetalServerPrototypeModel.Zone = zoneIdentityModel - bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} - bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel - - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions)`, func() { - version := "2024-06-23" - createBareMetalServerPath := "/bare_metal_servers" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) // If there is a body, then make sure we can read it bodyBuf := new(bytes.Buffer) @@ -43050,11 +43483,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke CreateBareMetalServer successfully with retries`, func() { + It(`Invoke UpdatePlacementGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43064,116 +43497,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model - bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model - bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) - bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel - bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel - bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - bareMetalServerPrototypeModel.VPC = vpcIdentityModel - bareMetalServerPrototypeModel.Zone = zoneIdentityModel - bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} - bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateBareMetalServerWithContext(ctx, createBareMetalServerOptionsModel) + _, _, operationErr := vpcService.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -43181,7 +43526,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBareMetalServerWithContext(ctx, createBareMetalServerOptionsModel) + _, _, operationErr = vpcService.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -43195,8 +43540,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -43218,11 +43563,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r006-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke CreateBareMetalServer successfully`, func() { + It(`Invoke UpdatePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43232,119 +43577,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBareMetalServer(nil) + result, response, operationErr := vpcService.UpdatePlacementGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model - bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model - bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) - bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel - bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel - bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - bareMetalServerPrototypeModel.VPC = vpcIdentityModel - bareMetalServerPrototypeModel.Zone = zoneIdentityModel - bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} - bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke UpdatePlacementGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43353,117 +43610,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model - bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model - bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) - bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel - bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel - bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - bareMetalServerPrototypeModel.VPC = vpcIdentityModel - bareMetalServerPrototypeModel.Zone = zoneIdentityModel - bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} - bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateBareMetalServerOptions model with no property values - createBareMetalServerOptionsModelNew := new(vpcv1.CreateBareMetalServerOptions) + // Construct a second instance of the UpdatePlacementGroupOptions model with no property values + updatePlacementGroupOptionsModelNew := new(vpcv1.UpdatePlacementGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModelNew) + result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -43478,10 +43647,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateBareMetalServer successfully`, func() { + It(`Invoke UpdatePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43490,130 +43659,8566 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + // Invoke operation + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) - Operation response error`, func() { + version := "2024-06-23" + listBareMetalServerProfilesPath := "/bare_metal_server/profiles" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListBareMetalServerProfiles with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions)`, func() { + version := "2024-06-23" + listBareMetalServerProfilesPath := "/bare_metal_server/profiles" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServerProfiles successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListBareMetalServerProfilesWithContext(ctx, listBareMetalServerProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListBareMetalServerProfilesWithContext(ctx, listBareMetalServerProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServerProfiles successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBareMetalServerProfiles(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBareMetalServerProfiles with error: Operation request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListBareMetalServerProfiles successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BareMetalServerProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.BareMetalServerProfileCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.BareMetalServerProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"default":"amd64","type":"fixed","value":"amd64"},"cpu_core_count":{"type":"fixed","value":80},"cpu_socket_count":{"type":"fixed","value":4},"disks":[{"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":100},"supported_interface_types":{"default":"fcp","type":"enum","values":["fcp"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","memory":{"type":"fixed","value":16},"name":"bx2-metal-192x768","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"default":"amd64","type":"fixed","value":"amd64"},"cpu_core_count":{"type":"fixed","value":80},"cpu_socket_count":{"type":"fixed","value":4},"disks":[{"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":100},"supported_interface_types":{"default":"fcp","type":"enum","values":["fcp"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","memory":{"type":"fixed","value":16},"name":"bx2-metal-192x768","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"default":"disabled","type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use BareMetalServerProfilesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBareMetalServerProfilesOptionsModel := &vpcv1.ListBareMetalServerProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerProfilesPager(listBareMetalServerProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BareMetalServerProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use BareMetalServerProfilesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBareMetalServerProfilesOptionsModel := &vpcv1.ListBareMetalServerProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerProfilesPager(listBareMetalServerProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) - Operation response error`, func() { + version := "2024-06-23" + getBareMetalServerProfilePath := "/bare_metal_server/profiles/bx2-metal-192x768" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetBareMetalServerProfile with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") + getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions)`, func() { + version := "2024-06-23" + getBareMetalServerProfilePath := "/bare_metal_server/profiles/bx2-metal-192x768" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}`) + })) + }) + It(`Invoke GetBareMetalServerProfile successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") + getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetBareMetalServerProfileWithContext(ctx, getBareMetalServerProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetBareMetalServerProfileWithContext(ctx, getBareMetalServerProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"default": "disabled", "type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}`) + })) + }) + It(`Invoke GetBareMetalServerProfile successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetBareMetalServerProfile(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") + getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBareMetalServerProfile with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") + getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetBareMetalServerProfileOptions model with no property values + getBareMetalServerProfileOptionsModelNew := new(vpcv1.GetBareMetalServerProfileOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetBareMetalServerProfile successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("bx2-metal-192x768") + getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) - Operation response error`, func() { + version := "2024-06-23" + listBareMetalServersPath := "/bare_metal_servers" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListBareMetalServers with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions)`, func() { + version := "2024-06-23" + listBareMetalServersPath := "/bare_metal_servers" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServers successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListBareMetalServersWithContext(ctx, listBareMetalServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListBareMetalServersWithContext(ctx, listBareMetalServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServers successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBareMetalServers(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBareMetalServers with error: Operation request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListBareMetalServers successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("my-name") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BareMetalServerCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.BareMetalServerCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.BareMetalServerCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"bare_metal_servers":[{"bandwidth":20000,"boot_target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk"},"cpu":{"architecture":"amd64","core_count":80,"socket_count":4,"threads_per_core":2},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","name":"bx2-metal-192x768","resource_type":"bare_metal_server_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"bare_metal_server","status":"deleting","status_reasons":[{"code":"cannot_start_capacity","message":"The bare metal server cannot start as there is no more capacity in this\\nzone for a bare metal server with the requested profile.","more_info":"https://console.bluemix.net/docs/iaas/bare_metal_server.html"}],"trusted_platform_module":{"enabled":true,"mode":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"bare_metal_servers":[{"bandwidth":20000,"boot_target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk"},"cpu":{"architecture":"amd64","core_count":80,"socket_count":4,"threads_per_core":2},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"firmware":{"update":"none"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","id":"0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","name":"bx2-metal-192x768","resource_type":"bare_metal_server_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"bare_metal_server","status":"deleting","status_reasons":[{"code":"cannot_start_capacity","message":"The bare metal server cannot start as there is no more capacity in this\\nzone for a bare metal server with the requested profile.","more_info":"https://console.bluemix.net/docs/iaas/bare_metal_server.html"}],"trusted_platform_module":{"enabled":true,"mode":"disabled","supported_modes":["disabled"]},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use BareMetalServersPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBareMetalServersOptionsModel := &vpcv1.ListBareMetalServersOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"), + VPCName: core.StringPtr("my-vpc"), + } + + pager, err := vpcService.NewBareMetalServersPager(listBareMetalServersOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BareMetalServer + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use BareMetalServersPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBareMetalServersOptionsModel := &vpcv1.ListBareMetalServersOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"), + VPCName: core.StringPtr("my-vpc"), + } + + pager, err := vpcService.NewBareMetalServersPager(listBareMetalServersOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) - Operation response error`, func() { + version := "2024-06-23" + createBareMetalServerPath := "/bare_metal_servers" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateBareMetalServer with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions)`, func() { + version := "2024-06-23" + createBareMetalServerPath := "/bare_metal_servers" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateBareMetalServer successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.CreateBareMetalServerWithContext(ctx, createBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.CreateBareMetalServerWithContext(ctx, createBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.CreateBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateBareMetalServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateBareMetalServerOptions model with no property values + createBareMetalServerOptionsModelNew := new(vpcv1.CreateBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) - Operation response error`, func() { + version := "2024-06-23" + createBareMetalServerConsoleAccessTokenPath := "/bare_metal_servers/testString/console_access_token" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateBareMetalServerConsoleAccessToken with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions)`, func() { + version := "2024-06-23" + createBareMetalServerConsoleAccessTokenPath := "/bare_metal_servers/testString/console_access_token" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}`) + })) + }) + It(`Invoke CreateBareMetalServerConsoleAccessToken successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.CreateBareMetalServerConsoleAccessTokenWithContext(ctx, createBareMetalServerConsoleAccessTokenOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.CreateBareMetalServerConsoleAccessTokenWithContext(ctx, createBareMetalServerConsoleAccessTokenOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}`) + })) + }) + It(`Invoke CreateBareMetalServerConsoleAccessToken successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateBareMetalServerConsoleAccessToken with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateBareMetalServerConsoleAccessTokenOptions model with no property values + createBareMetalServerConsoleAccessTokenOptionsModelNew := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke CreateBareMetalServerConsoleAccessToken successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) - Operation response error`, func() { + version := "2024-06-23" + listBareMetalServerDisksPath := "/bare_metal_servers/testString/disks" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListBareMetalServerDisks with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions)`, func() { + version := "2024-06-23" + listBareMetalServerDisksPath := "/bare_metal_servers/testString/disks" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + })) + }) + It(`Invoke ListBareMetalServerDisks successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListBareMetalServerDisksWithContext(ctx, listBareMetalServerDisksOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListBareMetalServerDisksWithContext(ctx, listBareMetalServerDisksOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + })) + }) + It(`Invoke ListBareMetalServerDisks successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBareMetalServerDisks(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBareMetalServerDisks with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListBareMetalServerDisksOptions model with no property values + listBareMetalServerDisksOptionsModelNew := new(vpcv1.ListBareMetalServerDisksOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListBareMetalServerDisks successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) - Operation response error`, func() { + version := "2024-06-23" + getBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetBareMetalServerDisk with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions)`, func() { + version := "2024-06-23" + getBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + })) + }) + It(`Invoke GetBareMetalServerDisk successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetBareMetalServerDiskWithContext(ctx, getBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetBareMetalServerDiskWithContext(ctx, getBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + })) + }) + It(`Invoke GetBareMetalServerDisk successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetBareMetalServerDisk(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBareMetalServerDisk with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetBareMetalServerDiskOptions model with no property values + getBareMetalServerDiskOptionsModelNew := new(vpcv1.GetBareMetalServerDiskOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetBareMetalServerDisk successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) - Operation response error`, func() { + version := "2024-06-23" + updateBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateBareMetalServerDisk with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions)`, func() { + version := "2024-06-23" + updateBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + })) + }) + It(`Invoke UpdateBareMetalServerDisk successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.UpdateBareMetalServerDiskWithContext(ctx, updateBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.UpdateBareMetalServerDiskWithContext(ctx, updateBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + })) + }) + It(`Invoke UpdateBareMetalServerDisk successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateBareMetalServerDisk with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateBareMetalServerDiskOptions model with no property values + updateBareMetalServerDiskOptionsModelNew := new(vpcv1.UpdateBareMetalServerDiskOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateBareMetalServerDisk successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) - Operation response error`, func() { + version := "2024-06-23" + listBareMetalServerNetworkAttachmentsPath := "/bare_metal_servers/testString/network_attachments" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListBareMetalServerNetworkAttachments with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions)`, func() { + version := "2024-06-23" + listBareMetalServerNetworkAttachmentsPath := "/bare_metal_servers/testString/network_attachments" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkAttachments successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListBareMetalServerNetworkAttachmentsWithContext(ctx, listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListBareMetalServerNetworkAttachmentsWithContext(ctx, listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkAttachments successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBareMetalServerNetworkAttachments with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListBareMetalServerNetworkAttachmentsOptions model with no property values + listBareMetalServerNetworkAttachmentsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListBareMetalServerNetworkAttachments successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BareMetalServerNetworkAttachmentCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.BareMetalServerNetworkAttachmentCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.BareMetalServerNetworkAttachmentCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","port_speed":1000,"primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","port_speed":1000,"primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use BareMetalServerNetworkAttachmentsPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBareMetalServerNetworkAttachmentsOptionsModel := &vpcv1.ListBareMetalServerNetworkAttachmentsOptions{ + BareMetalServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerNetworkAttachmentsPager(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BareMetalServerNetworkAttachmentIntf + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use BareMetalServerNetworkAttachmentsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBareMetalServerNetworkAttachmentsOptionsModel := &vpcv1.ListBareMetalServerNetworkAttachmentsOptions{ + BareMetalServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerNetworkAttachmentsPager(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { + version := "2024-06-23" + createBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions)`, func() { + version := "2024-06-23" + createBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + })) + }) + It(`Invoke CreateBareMetalServerNetworkAttachment successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.CreateBareMetalServerNetworkAttachmentWithContext(ctx, createBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.CreateBareMetalServerNetworkAttachmentWithContext(ctx, createBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + })) + }) + It(`Invoke CreateBareMetalServerNetworkAttachment successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateBareMetalServerNetworkAttachmentOptions model with no property values + createBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateBareMetalServerNetworkAttachment successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions)`, func() { + version := "2024-06-23" + deleteBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteBareMetalServerNetworkAttachment successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteBareMetalServerNetworkAttachment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteBareMetalServerNetworkAttachmentOptions model + deleteBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) + deleteBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteBareMetalServerNetworkAttachmentOptions model + deleteBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) + deleteBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteBareMetalServerNetworkAttachmentOptions model with no property values + deleteBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { + version := "2024-06-23" + getBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions)`, func() { + version := "2024-06-23" + getBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + })) + }) + It(`Invoke GetBareMetalServerNetworkAttachment successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetBareMetalServerNetworkAttachmentWithContext(ctx, getBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetBareMetalServerNetworkAttachmentWithContext(ctx, getBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + })) + }) + It(`Invoke GetBareMetalServerNetworkAttachment successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetBareMetalServerNetworkAttachmentOptions model with no property values + getBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetBareMetalServerNetworkAttachment successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { + version := "2024-06-23" + updateBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions)`, func() { + version := "2024-06-23" + updateBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + })) + }) + It(`Invoke UpdateBareMetalServerNetworkAttachment successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.UpdateBareMetalServerNetworkAttachmentWithContext(ctx, updateBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.UpdateBareMetalServerNetworkAttachmentWithContext(ctx, updateBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + })) + }) + It(`Invoke UpdateBareMetalServerNetworkAttachment successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateBareMetalServerNetworkAttachmentOptions model with no property values + updateBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateBareMetalServerNetworkAttachment successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) - Operation response error`, func() { + version := "2024-06-23" + listBareMetalServerNetworkInterfacesPath := "/bare_metal_servers/testString/network_interfaces" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaces with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions)`, func() { + version := "2024-06-23" + listBareMetalServerNetworkInterfacesPath := "/bare_metal_servers/testString/network_interfaces" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaces successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListBareMetalServerNetworkInterfacesWithContext(ctx, listBareMetalServerNetworkInterfacesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfacesWithContext(ctx, listBareMetalServerNetworkInterfacesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBareMetalServerNetworkInterfaces with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListBareMetalServerNetworkInterfacesOptions model with no property values + listBareMetalServerNetworkInterfacesOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BareMetalServerNetworkInterfaceCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.BareMetalServerNetworkInterfaceCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.BareMetalServerNetworkInterfaceCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_interfaces":[{"allow_ip_spoofing":true,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":true,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-network-interface","port_speed":1000,"primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"network_interfaces":[{"allow_ip_spoofing":true,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":true,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-network-interface","port_speed":1000,"primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use BareMetalServerNetworkInterfacesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBareMetalServerNetworkInterfacesOptionsModel := &vpcv1.ListBareMetalServerNetworkInterfacesOptions{ + BareMetalServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerNetworkInterfacesPager(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BareMetalServerNetworkInterfaceIntf + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use BareMetalServerNetworkInterfacesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBareMetalServerNetworkInterfacesOptionsModel := &vpcv1.ListBareMetalServerNetworkInterfacesOptions{ + BareMetalServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerNetworkInterfacesPager(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + version := "2024-06-23" + createBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions)`, func() { + version := "2024-06-23" + createBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + })) + }) + It(`Invoke CreateBareMetalServerNetworkInterface successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.CreateBareMetalServerNetworkInterfaceWithContext(ctx, createBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.CreateBareMetalServerNetworkInterfaceWithContext(ctx, createBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + })) + }) + It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateBareMetalServerNetworkInterfaceOptions model with no property values + createBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions)`, func() { + version := "2024-06-23" + deleteBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteBareMetalServerNetworkInterface successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteBareMetalServerNetworkInterface(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model + deleteBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) + deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model + deleteBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) + deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteBareMetalServerNetworkInterfaceOptions model with no property values + deleteBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + version := "2024-06-23" + getBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions)`, func() { + version := "2024-06-23" + getBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterface successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceWithContext(ctx, getBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceWithContext(ctx, getBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetBareMetalServerNetworkInterfaceOptions model with no property values + getBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + version := "2024-06-23" + updateBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions)`, func() { + version := "2024-06-23" + updateBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + })) + }) + It(`Invoke UpdateBareMetalServerNetworkInterface successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.UpdateBareMetalServerNetworkInterfaceWithContext(ctx, updateBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.UpdateBareMetalServerNetworkInterfaceWithContext(ctx, updateBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + })) + }) + It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateBareMetalServerNetworkInterfaceOptions model with no property values + updateBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { + version := "2024-06-23" + listBareMetalServerNetworkInterfaceFloatingIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions)`, func() { + version := "2024-06-23" + listBareMetalServerNetworkInterfaceFloatingIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx, listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx, listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model with no property values + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { + version := "2024-06-23" + removeBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(removeBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke RemoveBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + version := "2024-06-23" + getBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { + version := "2024-06-23" + getBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values + getBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + version := "2024-06-23" + addBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { + version := "2024-06-23" + addBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values + addBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) - Operation response error`, func() { + version := "2024-06-23" + listBareMetalServerNetworkInterfaceIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/ips" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model + listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) + listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions)`, func() { + version := "2024-06-23" + listBareMetalServerNetworkInterfaceIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/ips" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model + listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) + listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIpsWithContext(ctx, listBareMetalServerNetworkInterfaceIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIpsWithContext(ctx, listBareMetalServerNetworkInterfaceIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model + listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) + listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model + listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) + listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListBareMetalServerNetworkInterfaceIpsOptions model with no property values + listBareMetalServerNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model + listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) + listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) - Operation response error`, func() { + version := "2024-06-23" + getBareMetalServerNetworkInterfaceIPPath := "/bare_metal_servers/testString/network_interfaces/testString/ips/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model + getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) + getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions)`, func() { + version := "2024-06-23" + getBareMetalServerNetworkInterfaceIPPath := "/bare_metal_servers/testString/network_interfaces/testString/ips/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model + getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) + getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIPWithContext(ctx, getBareMetalServerNetworkInterfaceIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIPWithContext(ctx, getBareMetalServerNetworkInterfaceIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model + getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) + getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model + getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) + getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetBareMetalServerNetworkInterfaceIPOptions model with no property values + getBareMetalServerNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model + getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) + getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions)`, func() { + version := "2024-06-23" + deleteBareMetalServerPath := "/bare_metal_servers/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteBareMetalServerPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteBareMetalServerOptions model + deleteBareMetalServerOptionsModel := new(vpcv1.DeleteBareMetalServerOptions) + deleteBareMetalServerOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteBareMetalServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteBareMetalServerOptions model + deleteBareMetalServerOptionsModel := new(vpcv1.DeleteBareMetalServerOptions) + deleteBareMetalServerOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteBareMetalServerOptions model with no property values + deleteBareMetalServerOptionsModelNew := new(vpcv1.DeleteBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) - Operation response error`, func() { + version := "2024-06-23" + getBareMetalServerPath := "/bare_metal_servers/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetBareMetalServer with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions)`, func() { + version := "2024-06-23" + getBareMetalServerPath := "/bare_metal_servers/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetBareMetalServer successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetBareMetalServerWithContext(ctx, getBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetBareMetalServerWithContext(ctx, getBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBareMetalServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetBareMetalServerOptions model with no property values + getBareMetalServerOptionsModelNew := new(vpcv1.GetBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) - Operation response error`, func() { + version := "2024-06-23" + updateBareMetalServerPath := "/bare_metal_servers/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateBareMetalServer with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions)`, func() { + version := "2024-06-23" + updateBareMetalServerPath := "/bare_metal_servers/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateBareMetalServer successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.UpdateBareMetalServerWithContext(ctx, updateBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.UpdateBareMetalServerWithContext(ctx, updateBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/disks/0717-3744f199-6ccc-4698-8772-bb3937348c96", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "id": "0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_attachments/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.UpdateBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateBareMetalServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateBareMetalServerOptions model with no property values + updateBareMetalServerOptionsModelNew := new(vpcv1.UpdateBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions)`, func() { + version := "2024-06-23" + updateFirmwareForBareMetalServerPath := "/bare_metal_servers/testString/firmware/update" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateFirmwareForBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke UpdateFirmwareForBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.UpdateFirmwareForBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the UpdateFirmwareForBareMetalServerOptions model + updateFirmwareForBareMetalServerOptionsModel := new(vpcv1.UpdateFirmwareForBareMetalServerOptions) + updateFirmwareForBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateFirmwareForBareMetalServerOptionsModel.AutoStart = core.BoolPtr(true) + updateFirmwareForBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke UpdateFirmwareForBareMetalServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the UpdateFirmwareForBareMetalServerOptions model + updateFirmwareForBareMetalServerOptionsModel := new(vpcv1.UpdateFirmwareForBareMetalServerOptions) + updateFirmwareForBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateFirmwareForBareMetalServerOptionsModel.AutoStart = core.BoolPtr(true) + updateFirmwareForBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the UpdateFirmwareForBareMetalServerOptions model with no property values + updateFirmwareForBareMetalServerOptionsModelNew := new(vpcv1.UpdateFirmwareForBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) - Operation response error`, func() { + version := "2024-06-23" + getBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetBareMetalServerInitialization with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions)`, func() { + version := "2024-06-23" + getBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + })) + }) + It(`Invoke GetBareMetalServerInitialization successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetBareMetalServerInitializationWithContext(ctx, getBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetBareMetalServerInitializationWithContext(ctx, getBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + })) + }) + It(`Invoke GetBareMetalServerInitialization successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetBareMetalServerInitialization(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBareMetalServerInitialization with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetBareMetalServerInitializationOptions model with no property values + getBareMetalServerInitializationOptionsModelNew := new(vpcv1.GetBareMetalServerInitializationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetBareMetalServerInitialization successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptions *ReplaceBareMetalServerInitializationOptions) - Operation response error`, func() { + version := "2024-06-23" + replaceBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceBareMetalServerInitializationPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ReplaceBareMetalServerInitialization with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the ReplaceBareMetalServerInitializationOptions model + replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) + replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel + replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptions *ReplaceBareMetalServerInitializationOptions)`, func() { + version := "2024-06-23" + replaceBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceBareMetalServerInitializationPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + })) + }) + It(`Invoke ReplaceBareMetalServerInitialization successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the ReplaceBareMetalServerInitializationOptions model + replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) + replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel + replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ReplaceBareMetalServerInitializationWithContext(ctx, replaceBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ReplaceBareMetalServerInitializationWithContext(ctx, replaceBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceBareMetalServerInitializationPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "r006-82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + })) + }) + It(`Invoke ReplaceBareMetalServerInitialization successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the ReplaceBareMetalServerInitializationOptions model + replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) + replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel + replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ReplaceBareMetalServerInitialization with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the ReplaceBareMetalServerInitializationOptions model + replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) + replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel + replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ReplaceBareMetalServerInitializationOptions model with no property values + replaceBareMetalServerInitializationOptionsModelNew := new(vpcv1.ReplaceBareMetalServerInitializationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ReplaceBareMetalServerInitialization successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the ReplaceBareMetalServerInitializationOptions model + replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) + replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel + replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") + replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions)`, func() { + version := "2024-06-23" + restartBareMetalServerPath := "/bare_metal_servers/testString/restart" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(restartBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke RestartBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.RestartBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + // Construct an instance of the RestartBareMetalServerOptions model + restartBareMetalServerOptionsModel := new(vpcv1.RestartBareMetalServerOptions) + restartBareMetalServerOptionsModel.ID = core.StringPtr("testString") + restartBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RestartBareMetalServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") + // Construct an instance of the RestartBareMetalServerOptions model + restartBareMetalServerOptionsModel := new(vpcv1.RestartBareMetalServerOptions) + restartBareMetalServerOptionsModel.ID = core.StringPtr("testString") + restartBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RestartBareMetalServerOptions model with no property values + restartBareMetalServerOptionsModelNew := new(vpcv1.RestartBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions)`, func() { + version := "2024-06-23" + startBareMetalServerPath := "/bare_metal_servers/testString/start" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(startBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke StartBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.StartBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the StartBareMetalServerOptions model + startBareMetalServerOptionsModel := new(vpcv1.StartBareMetalServerOptions) + startBareMetalServerOptionsModel.ID = core.StringPtr("testString") + startBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.StartBareMetalServer(startBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke StartBareMetalServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the StartBareMetalServerOptions model + startBareMetalServerOptionsModel := new(vpcv1.StartBareMetalServerOptions) + startBareMetalServerOptionsModel.ID = core.StringPtr("testString") + startBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.StartBareMetalServer(startBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the StartBareMetalServerOptions model with no property values + startBareMetalServerOptionsModelNew := new(vpcv1.StartBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.StartBareMetalServer(startBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions)`, func() { + version := "2024-06-23" + stopBareMetalServerPath := "/bare_metal_servers/testString/stop" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(stopBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke StopBareMetalServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.StopBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the StopBareMetalServerOptions model + stopBareMetalServerOptionsModel := new(vpcv1.StopBareMetalServerOptions) + stopBareMetalServerOptionsModel.ID = core.StringPtr("testString") + stopBareMetalServerOptionsModel.Type = core.StringPtr("hard") + stopBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.StopBareMetalServer(stopBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke StopBareMetalServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the StopBareMetalServerOptions model + stopBareMetalServerOptionsModel := new(vpcv1.StopBareMetalServerOptions) + stopBareMetalServerOptionsModel.ID = core.StringPtr("testString") + stopBareMetalServerOptionsModel.Type = core.StringPtr("hard") + stopBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.StopBareMetalServer(stopBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the StopBareMetalServerOptions model with no property values + stopBareMetalServerOptionsModelNew := new(vpcv1.StopBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.StopBareMetalServer(stopBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) - Operation response error`, func() { + version := "2024-06-23" + listVolumeProfilesPath := "/volume/profiles" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVolumeProfiles with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions)`, func() { + version := "2024-06-23" + listVolumeProfilesPath := "/volume/profiles" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose"}], "total_count": 132}`) + })) + }) + It(`Invoke ListVolumeProfiles successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListVolumeProfilesWithContext(ctx, listVolumeProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListVolumeProfilesWithContext(ctx, listVolumeProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose"}], "total_count": 132}`) + })) + }) + It(`Invoke ListVolumeProfiles successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListVolumeProfiles(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVolumeProfiles with error: Operation request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListVolumeProfiles successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VolumeProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.VolumeProfileCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.VolumeProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VolumeProfilesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model - bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model - bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) - bareMetalServerPrototypeModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel - bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel - bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - bareMetalServerPrototypeModel.VPC = vpcIdentityModel - bareMetalServerPrototypeModel.Zone = zoneIdentityModel - bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} - bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + var allResults []vpcv1.VolumeProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use VolumeProfilesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } - // Invoke operation - result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) - Operation response error`, func() { + Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) - Operation response error`, func() { version := "2024-06-23" - createBareMetalServerConsoleAccessTokenPath := "/bare_metal_servers/testString/console_access_token" + getVolumeProfilePath := "/volume/profiles/10iops-tier" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -43621,7 +52226,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken with error: Operation response processing error`, func() { + It(`Invoke GetVolumeProfile with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43630,21 +52235,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -43654,33 +52257,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions)`, func() { + Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions)`, func() { version := "2024-06-23" - createBareMetalServerConsoleAccessTokenPath := "/bare_metal_servers/testString/console_access_token" + getVolumeProfilePath := "/volume/profiles/10iops-tier" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -43690,10 +52277,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}`) + fmt.Fprintf(res, "%s", `{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose"}`) })) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken successfully with retries`, func() { + It(`Invoke GetVolumeProfile successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43703,23 +52290,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateBareMetalServerConsoleAccessTokenWithContext(ctx, createBareMetalServerConsoleAccessTokenOptionsModel) + _, _, operationErr := vpcService.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -43727,7 +52312,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBareMetalServerConsoleAccessTokenWithContext(ctx, createBareMetalServerConsoleAccessTokenOptionsModel) + _, _, operationErr = vpcService.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -43741,34 +52326,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWEyNDMyYjFmYTRkNGFjZTg5MWU5YjgwZmMxMDRlMzQiLCJzZWNyZXQiOiJRVzRnWlhoaGJYQnNaU0J6WldOeVpYUUsiLCJleHAiOjE3MjYwNzU1OTR9.UFDVzzGJ54Go9Z4jgyPSLG49zNx-AjHTQrJA6ee8KLI"}`) + fmt.Fprintf(res, "%s", `{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose"}`) })) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken successfully`, func() { + It(`Invoke GetVolumeProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43778,26 +52347,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(nil) + result, response, operationErr := vpcService.GetVolumeProfile(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken with error: Operation validation and request error`, func() { + It(`Invoke GetVolumeProfile with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43806,24 +52373,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateBareMetalServerConsoleAccessTokenOptions model with no property values - createBareMetalServerConsoleAccessTokenOptionsModelNew := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + // Construct a second instance of the GetVolumeProfileOptions model with no property values + getVolumeProfileOptionsModelNew := new(vpcv1.GetVolumeProfileOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModelNew) + result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -43841,7 +52406,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken successfully`, func() { + It(`Invoke GetVolumeProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43850,15 +52415,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -43870,25 +52433,34 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) - Operation response error`, func() { + Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions) - Operation response error`, func() { version := "2024-06-23" - listBareMetalServerDisksPath := "/bare_metal_servers/testString/disks" + listVolumesPath := "/volumes" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) + Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) + Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) + Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerDisks with error: Operation response processing error`, func() { + It(`Invoke ListVolumes with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43897,19 +52469,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("my-name") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.Tag = core.StringPtr("testString") + listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr = vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -43919,30 +52499,39 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions)`, func() { + Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions)`, func() { version := "2024-06-23" - listBareMetalServerDisksPath := "/bare_metal_servers/testString/disks" + listVolumesPath := "/volumes" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) + Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) + Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) + Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke ListBareMetalServerDisks successfully with retries`, func() { + It(`Invoke ListVolumes successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43952,21 +52541,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("my-name") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.Tag = core.StringPtr("testString") + listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBareMetalServerDisksWithContext(ctx, listBareMetalServerDisksOptionsModel) + _, _, operationErr := vpcService.ListVolumesWithContext(ctx, listVolumesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -43974,7 +52571,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerDisksWithContext(ctx, listBareMetalServerDisksOptionsModel) + _, _, operationErr = vpcService.ListVolumesWithContext(ctx, listVolumesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -43988,18 +52585,27 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) + Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) + Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) + Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke ListBareMetalServerDisks successfully`, func() { + It(`Invoke ListVolumes successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44009,24 +52615,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerDisks(nil) + result, response, operationErr := vpcService.ListVolumes(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("my-name") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.Tag = core.StringPtr("testString") + listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr = vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerDisks with error: Operation validation and request error`, func() { + It(`Invoke ListVolumes with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44035,25 +52649,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("my-name") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.Tag = core.StringPtr("testString") + listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListBareMetalServerDisksOptions model with no property values - listBareMetalServerDisksOptionsModelNew := new(vpcv1.ListBareMetalServerDisksOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -44068,7 +52683,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerDisks successfully`, func() { + It(`Invoke ListVolumes successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44077,13 +52692,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("my-name") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.Tag = core.StringPtr("testString") + listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -44094,26 +52717,141 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VolumeCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.VolumeCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.VolumeCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"attachment_state":"attached","bandwidth":1000,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"status":"available","status_reasons":[{"code":"encryption_key_deleted","message":"Message","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"user_tags":["UserTags"],"volume_attachments":[{"delete_volume_on_instance_delete":true,"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"ID"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"name":"my-volume-attachment","type":"boot"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"attachment_state":"attached","bandwidth":1000,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"status":"available","status_reasons":[{"code":"encryption_key_deleted","message":"Message","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"user_tags":["UserTags"],"volume_attachments":[{"delete_volume_on_instance_delete":true,"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"ID"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","id":"0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0","name":"my-instance"},"name":"my-volume-attachment","type":"boot"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VolumesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listVolumesOptionsModel := &vpcv1.ListVolumesOptions{ + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + AttachmentState: core.StringPtr("attached"), + Encryption: core.StringPtr("provider_managed"), + OperatingSystemFamily: core.StringPtr("Ubuntu Server"), + OperatingSystemArchitecture: core.StringPtr("amd64"), + ZoneName: core.StringPtr("us-south-1"), + Tag: core.StringPtr("testString"), + } + + pager, err := vpcService.NewVolumesPager(listVolumesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Volume + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use VolumesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listVolumesOptionsModel := &vpcv1.ListVolumesOptions{ + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + AttachmentState: core.StringPtr("attached"), + Encryption: core.StringPtr("provider_managed"), + OperatingSystemFamily: core.StringPtr("Ubuntu Server"), + OperatingSystemArchitecture: core.StringPtr("amd64"), + ZoneName: core.StringPtr("us-south-1"), + Tag: core.StringPtr("testString"), + } + + pager, err := vpcService.NewVolumesPager(listVolumesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) - Operation response error`, func() { + Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions) - Operation response error`, func() { version := "2024-06-23" - getBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + createVolumePath := "/volumes" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerDisk with error: Operation response processing error`, func() { + It(`Invoke CreateVolume with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44122,20 +52860,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("custom") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -44145,17 +52909,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions)`, func() { + Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions)`, func() { version := "2024-06-23" - getBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + createVolumePath := "/volumes" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -44164,11 +52944,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetBareMetalServerDisk successfully with retries`, func() { + It(`Invoke CreateVolume successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44178,22 +52958,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("custom") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerDiskWithContext(ctx, getBareMetalServerDiskOptionsModel) + _, _, operationErr := vpcService.CreateVolumeWithContext(ctx, createVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -44201,7 +53007,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerDiskWithContext(ctx, getBareMetalServerDiskOptionsModel) + _, _, operationErr = vpcService.CreateVolumeWithContext(ctx, createVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -44215,18 +53021,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetBareMetalServerDisk successfully`, func() { + It(`Invoke CreateVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44236,25 +53058,51 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerDisk(nil) + result, response, operationErr := vpcService.CreateVolume(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("custom") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerDisk with error: Operation validation and request error`, func() { + It(`Invoke CreateVolume with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44263,23 +53111,49 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("custom") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerDiskOptions model with no property values - getBareMetalServerDiskOptionsModelNew := new(vpcv1.GetBareMetalServerDiskOptions) + // Construct a second instance of the CreateVolumeOptions model with no property values + createVolumeOptionsModelNew := new(vpcv1.CreateVolumeOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModelNew) + result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -44294,10 +53168,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetBareMetalServerDisk successfully`, func() { + It(`Invoke CreateVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44306,14 +53180,40 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("custom") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -44325,17 +53225,94 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) - Operation response error`, func() { + Describe(`DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions)`, func() { version := "2024-06-23" - updateBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + deleteVolumePath := "/volumes/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteVolumePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteVolume successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteVolume(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVolumeOptions model + deleteVolumeOptionsModel := new(vpcv1.DeleteVolumeOptions) + deleteVolumeOptionsModel.ID = core.StringPtr("testString") + deleteVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVolume(deleteVolumeOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVolume with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteVolumeOptions model + deleteVolumeOptionsModel := new(vpcv1.DeleteVolumeOptions) + deleteVolumeOptionsModel.ID = core.StringPtr("testString") + deleteVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteVolume(deleteVolumeOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVolumeOptions model with no property values + deleteVolumeOptionsModelNew := new(vpcv1.DeleteVolumeOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVolume(deleteVolumeOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVolume(getVolumeOptions *GetVolumeOptions) - Operation response error`, func() { + version := "2024-06-23" + getVolumePath := "/volumes/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -44343,7 +53320,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBareMetalServerDisk with error: Operation response processing error`, func() { + It(`Invoke GetVolume with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44352,27 +53329,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -44382,33 +53351,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions)`, func() { + Describe(`GetVolume(getVolumeOptions *GetVolumeOptions)`, func() { version := "2024-06-23" - updateBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + getVolumePath := "/volumes/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -44418,10 +53371,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateBareMetalServerDisk successfully with retries`, func() { + It(`Invoke GetVolume successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44431,29 +53384,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateBareMetalServerDiskWithContext(ctx, updateBareMetalServerDiskOptionsModel) + _, _, operationErr := vpcService.GetVolumeWithContext(ctx, getVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -44461,7 +53406,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBareMetalServerDiskWithContext(ctx, updateBareMetalServerDiskOptionsModel) + _, _, operationErr = vpcService.GetVolumeWithContext(ctx, getVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -44475,34 +53420,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateBareMetalServerDisk successfully`, func() { + It(`Invoke GetVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44512,32 +53441,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBareMetalServerDisk(nil) + result, response, operationErr := vpcService.GetVolume(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBareMetalServerDisk with error: Operation validation and request error`, func() { + It(`Invoke GetVolume with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44546,30 +53467,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateBareMetalServerDiskOptions model with no property values - updateBareMetalServerDiskOptionsModelNew := new(vpcv1.UpdateBareMetalServerDiskOptions) + // Construct a second instance of the GetVolumeOptions model with no property values + getVolumeOptionsModelNew := new(vpcv1.GetVolumeOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModelNew) + result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -44587,7 +53500,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBareMetalServerDisk successfully`, func() { + It(`Invoke GetVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44596,21 +53509,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -44622,27 +53527,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) - Operation response error`, func() { + Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) - Operation response error`, func() { version := "2024-06-23" - listBareMetalServerNetworkAttachmentsPath := "/bare_metal_servers/testString/network_attachments" + updateVolumePath := "/volumes/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerNetworkAttachments with error: Operation response processing error`, func() { + It(`Invoke UpdateVolume with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44651,21 +53556,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model - listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) - listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -44675,32 +53594,48 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions)`, func() { + Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions)`, func() { version := "2024-06-23" - listBareMetalServerNetworkAttachmentsPath := "/bare_metal_servers/testString/network_attachments" + updateVolumePath := "/volumes/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_attachments?limit=20"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_attachments?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListBareMetalServerNetworkAttachments successfully with retries`, func() { + It(`Invoke UpdateVolume successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44710,23 +53645,37 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model - listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) - listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBareMetalServerNetworkAttachmentsWithContext(ctx, listBareMetalServerNetworkAttachmentsOptionsModel) + _, _, operationErr := vpcService.UpdateVolumeWithContext(ctx, updateVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -44734,7 +53683,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerNetworkAttachmentsWithContext(ctx, listBareMetalServerNetworkAttachmentsOptionsModel) + _, _, operationErr = vpcService.UpdateVolumeWithContext(ctx, updateVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -44748,20 +53697,36 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_attachments?limit=20"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_attachments?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "ID"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListBareMetalServerNetworkAttachments successfully`, func() { + It(`Invoke UpdateVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44771,26 +53736,40 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(nil) + result, response, operationErr := vpcService.UpdateVolume(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model - listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) - listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerNetworkAttachments with error: Operation validation and request error`, func() { + It(`Invoke UpdateVolume with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44799,24 +53778,38 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model - listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) - listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListBareMetalServerNetworkAttachmentsOptions model with no property values - listBareMetalServerNetworkAttachmentsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + // Construct a second instance of the UpdateVolumeOptions model with no property values + updateVolumeOptionsModelNew := new(vpcv1.UpdateVolumeOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModelNew) + result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -44834,7 +53827,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerNetworkAttachments successfully`, func() { + It(`Invoke UpdateVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44843,15 +53836,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model - listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) - listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) + result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -44862,129 +53869,32 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BareMetalServerNetworkAttachmentCollection) - nextObject := new(vpcv1.BareMetalServerNetworkAttachmentCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.BareMetalServerNetworkAttachmentCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.BareMetalServerNetworkAttachmentCollection) - nextObject := new(vpcv1.BareMetalServerNetworkAttachmentCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","port_speed":1000,"primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","port_speed":1000,"primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"bare_metal_server_network_attachment","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use BareMetalServerNetworkAttachmentsPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listBareMetalServerNetworkAttachmentsOptionsModel := &vpcv1.ListBareMetalServerNetworkAttachmentsOptions{ - BareMetalServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewBareMetalServerNetworkAttachmentsPager(listBareMetalServerNetworkAttachmentsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.BareMetalServerNetworkAttachmentIntf - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use BareMetalServerNetworkAttachmentsPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listBareMetalServerNetworkAttachmentsOptionsModel := &vpcv1.ListBareMetalServerNetworkAttachmentsOptions{ - BareMetalServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewBareMetalServerNetworkAttachmentsPager(listBareMetalServerNetworkAttachmentsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { + Describe(`ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) - Operation response error`, func() { version := "2024-06-23" - createBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments" + listSnapshotConsistencyGroupsPath := "/snapshot_consistency_groups" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { + It(`Invoke ListSnapshotConsistencyGroups with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44993,64 +53903,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model - createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel - createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -45060,46 +53930,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions)`, func() { + Describe(`ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions)`, func() { version := "2024-06-23" - createBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments" + listSnapshotConsistencyGroupsPath := "/snapshot_consistency_groups" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "snapshot_consistency_groups": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}`) })) }) - It(`Invoke CreateBareMetalServerNetworkAttachment successfully with retries`, func() { + It(`Invoke ListSnapshotConsistencyGroups successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45109,66 +53969,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model - createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel - createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateBareMetalServerNetworkAttachmentWithContext(ctx, createBareMetalServerNetworkAttachmentOptionsModel) + _, _, operationErr := vpcService.ListSnapshotConsistencyGroupsWithContext(ctx, listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -45176,7 +53996,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBareMetalServerNetworkAttachmentWithContext(ctx, createBareMetalServerNetworkAttachmentOptionsModel) + _, _, operationErr = vpcService.ListSnapshotConsistencyGroupsWithContext(ctx, listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -45190,34 +54010,24 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "snapshot_consistency_groups": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}`) })) }) - It(`Invoke CreateBareMetalServerNetworkAttachment successfully`, func() { + It(`Invoke ListSnapshotConsistencyGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45227,69 +54037,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(nil) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model - createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel - createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { + It(`Invoke ListSnapshotConsistencyGroups with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45298,70 +54068,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model - createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel - createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateBareMetalServerNetworkAttachmentOptions model with no property values - createBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -45373,10 +54096,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateBareMetalServerNetworkAttachment successfully`, func() { + It(`Invoke ListSnapshotConsistencyGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45385,58 +54108,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ProtocolStateFilteringMode = core.StringPtr("auto") - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model - bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") - bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel - bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} - bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") - - // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model - createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel - createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -45447,25 +54130,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions)`, func() { - version := "2024-06-23" - deleteBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" - Context(`Using mock server endpoint`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"snapshot_consistency_groups":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["ServiceTags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"snapshot_consistency_groups":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["ServiceTags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke DeleteBareMetalServerNetworkAttachment successfully`, func() { + It(`Use SnapshotConsistencyGroupsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45474,23 +54191,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteBareMetalServerNetworkAttachment(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + listSnapshotConsistencyGroupsOptionsModel := &vpcv1.ListSnapshotConsistencyGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + } - // Construct an instance of the DeleteBareMetalServerNetworkAttachmentOptions model - deleteBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) - deleteBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - deleteBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + pager, err := vpcService.NewSnapshotConsistencyGroupsPager(listSnapshotConsistencyGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + var allResults []vpcv1.SnapshotConsistencyGroup + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - It(`Invoke DeleteBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { + It(`Use SnapshotConsistencyGroupsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45499,49 +54221,44 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBareMetalServerNetworkAttachmentOptions model - deleteBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) - deleteBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - deleteBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") + listSnapshotConsistencyGroupsOptionsModel := &vpcv1.ListSnapshotConsistencyGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewSnapshotConsistencyGroupsPager(listSnapshotConsistencyGroupsOptionsModel) Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteBareMetalServerNetworkAttachmentOptions model with no property values - deleteBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { + Describe(`CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) - Operation response error`, func() { version := "2024-06-23" - getBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + createSnapshotConsistencyGroupPath := "/snapshot_consistency_groups" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { + It(`Invoke CreateSnapshotConsistencyGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45550,20 +54267,40 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model - getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) - getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model + snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) + snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel + snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -45573,17 +54310,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions)`, func() { + Describe(`CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions)`, func() { version := "2024-06-23" - getBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + createSnapshotConsistencyGroupPath := "/snapshot_consistency_groups" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -45592,11 +54345,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke GetBareMetalServerNetworkAttachment successfully with retries`, func() { + It(`Invoke CreateSnapshotConsistencyGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45606,22 +54359,42 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model - getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) - getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model + snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) + snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel + snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerNetworkAttachmentWithContext(ctx, getBareMetalServerNetworkAttachmentOptionsModel) + _, _, operationErr := vpcService.CreateSnapshotConsistencyGroupWithContext(ctx, createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -45629,7 +54402,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerNetworkAttachmentWithContext(ctx, getBareMetalServerNetworkAttachmentOptionsModel) + _, _, operationErr = vpcService.CreateSnapshotConsistencyGroupWithContext(ctx, createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -45643,18 +54416,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke GetBareMetalServerNetworkAttachment successfully`, func() { + It(`Invoke CreateSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45664,25 +54453,45 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(nil) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model - getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) - getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model + snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) + snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel + snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { + It(`Invoke CreateSnapshotConsistencyGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45691,23 +54500,43 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model - getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) - getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model + snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) + snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel + snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerNetworkAttachmentOptions model with no property values - getBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + // Construct a second instance of the CreateSnapshotConsistencyGroupOptions model with no property values + createSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.CreateSnapshotConsistencyGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModelNew) + result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -45722,10 +54551,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetBareMetalServerNetworkAttachment successfully`, func() { + It(`Invoke CreateSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45734,14 +54563,34 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model - getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) - getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model + snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) + snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel + snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -45753,25 +54602,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { + Describe(`DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) - Operation response error`, func() { version := "2024-06-23" - updateBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + deleteSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45780,28 +54629,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkAttachmentPatch model - bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) - bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") - bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model - updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch - updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -45811,33 +54651,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions)`, func() { + Describe(`DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions)`, func() { version := "2024-06-23" - updateBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/testString" + deleteSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -45846,11 +54670,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke UpdateBareMetalServerNetworkAttachment successfully with retries`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45860,30 +54684,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BareMetalServerNetworkAttachmentPatch model - bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) - bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") - bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model - updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch - updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateBareMetalServerNetworkAttachmentWithContext(ctx, updateBareMetalServerNetworkAttachmentOptionsModel) + _, _, operationErr := vpcService.DeleteSnapshotConsistencyGroupWithContext(ctx, deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -45891,7 +54706,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBareMetalServerNetworkAttachmentWithContext(ctx, updateBareMetalServerNetworkAttachmentOptionsModel) + _, _, operationErr = vpcService.DeleteSnapshotConsistencyGroupWithContext(ctx, deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -45905,34 +54720,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke UpdateBareMetalServerNetworkAttachment successfully`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45942,33 +54741,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(nil) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BareMetalServerNetworkAttachmentPatch model - bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) - bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") - bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model - updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch - updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45977,31 +54767,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkAttachmentPatch model - bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) - bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") - bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model - updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch - updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateBareMetalServerNetworkAttachmentOptions model with no property values - updateBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + // Construct a second instance of the DeleteSnapshotConsistencyGroupOptions model with no property values + deleteSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModelNew) + result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -46016,10 +54797,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke UpdateBareMetalServerNetworkAttachment successfully`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46028,22 +54809,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkAttachmentPatch model - bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) - bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") - bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model - updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch - updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -46055,27 +54827,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) - Operation response error`, func() { + Describe(`GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) - Operation response error`, func() { version := "2024-06-23" - listBareMetalServerNetworkInterfacesPath := "/bare_metal_servers/testString/network_interfaces" + getSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaces with error: Operation response processing error`, func() { + It(`Invoke GetSnapshotConsistencyGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46084,21 +54854,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -46108,32 +54876,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions)`, func() { + Describe(`GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions)`, func() { version := "2024-06-23" - listBareMetalServerNetworkInterfacesPath := "/bare_metal_servers/testString/network_interfaces" + getSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaces successfully with retries`, func() { + It(`Invoke GetSnapshotConsistencyGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46143,23 +54909,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBareMetalServerNetworkInterfacesWithContext(ctx, listBareMetalServerNetworkInterfacesOptionsModel) + _, _, operationErr := vpcService.GetSnapshotConsistencyGroupWithContext(ctx, getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -46167,7 +54931,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfacesWithContext(ctx, listBareMetalServerNetworkInterfacesOptionsModel) + _, _, operationErr = vpcService.GetSnapshotConsistencyGroupWithContext(ctx, getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -46181,20 +54945,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { + It(`Invoke GetSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46204,26 +54966,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(nil) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerNetworkInterfaces with error: Operation validation and request error`, func() { + It(`Invoke GetSnapshotConsistencyGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46232,24 +54992,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListBareMetalServerNetworkInterfacesOptions model with no property values - listBareMetalServerNetworkInterfacesOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + // Construct a second instance of the GetSnapshotConsistencyGroupOptions model with no property values + getSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.GetSnapshotConsistencyGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModelNew) + result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -46267,7 +55025,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { + It(`Invoke GetSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46276,15 +55034,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -46295,129 +55051,28 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BareMetalServerNetworkInterfaceCollection) - nextObject := new(vpcv1.BareMetalServerNetworkInterfaceCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.BareMetalServerNetworkInterfaceCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.BareMetalServerNetworkInterfaceCollection) - nextObject := new(vpcv1.BareMetalServerNetworkInterfaceCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_interfaces":[{"allow_ip_spoofing":true,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":true,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-network-interface","port_speed":1000,"primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"network_interfaces":[{"allow_ip_spoofing":true,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":true,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-network-interface","port_speed":1000,"primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use BareMetalServerNetworkInterfacesPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listBareMetalServerNetworkInterfacesOptionsModel := &vpcv1.ListBareMetalServerNetworkInterfacesOptions{ - BareMetalServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewBareMetalServerNetworkInterfacesPager(listBareMetalServerNetworkInterfacesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.BareMetalServerNetworkInterfaceIntf - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use BareMetalServerNetworkInterfacesPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listBareMetalServerNetworkInterfacesOptionsModel := &vpcv1.ListBareMetalServerNetworkInterfacesOptions{ - BareMetalServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewBareMetalServerNetworkInterfacesPager(listBareMetalServerNetworkInterfacesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) - Operation response error`, func() { version := "2024-06-23" - createBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces" + updateSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46426,44 +55081,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -46473,17 +55112,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions)`, func() { + Describe(`UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions)`, func() { version := "2024-06-23" - createBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces" + updateSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -46501,6 +55140,8 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -46508,11 +55149,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke CreateBareMetalServerNetworkInterface successfully with retries`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46522,46 +55163,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateBareMetalServerNetworkInterfaceWithContext(ctx, createBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.UpdateSnapshotConsistencyGroupWithContext(ctx, updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -46569,7 +55194,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBareMetalServerNetworkInterfaceWithContext(ctx, createBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.UpdateSnapshotConsistencyGroupWithContext(ctx, updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -46583,8 +55208,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -46602,15 +55227,17 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46620,49 +55247,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(nil) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46671,47 +55282,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateBareMetalServerNetworkInterfaceOptions model with no property values - createBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + // Construct a second instance of the UpdateSnapshotConsistencyGroupOptions model with no property values + updateSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -46726,10 +55321,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46738,38 +55333,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -46781,24 +55360,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions)`, func() { + Describe(`DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions)`, func() { version := "2024-06-23" - deleteBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + deleteSnapshotsPath := "/snapshots" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotsPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + res.WriteHeader(202) })) }) - It(`Invoke DeleteBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke DeleteSnapshots successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46808,22 +55388,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteBareMetalServerNetworkInterface(nil) + response, operationErr := vpcService.DeleteSnapshots(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model - deleteBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) - deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotsOptions model + deleteSnapshotsOptionsModel := new(vpcv1.DeleteSnapshotsOptions) + deleteSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + deleteSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModel) + response, operationErr = vpcService.DeleteSnapshots(deleteSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke DeleteSnapshots with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46832,22 +55411,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model - deleteBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) - deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotsOptions model + deleteSnapshotsOptionsModel := new(vpcv1.DeleteSnapshotsOptions) + deleteSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + deleteSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModel) + response, operationErr := vpcService.DeleteSnapshots(deleteSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteBareMetalServerNetworkInterfaceOptions model with no property values - deleteBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) + // Construct a second instance of the DeleteSnapshotsOptions model with no property values + deleteSnapshotsOptionsModelNew := new(vpcv1.DeleteSnapshotsOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModelNew) + response, operationErr = vpcService.DeleteSnapshots(deleteSnapshotsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -46856,25 +55434,47 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) - Operation response error`, func() { version := "2024-06-23" - getBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + listSnapshotsPath := "/snapshots" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) + Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"crn:[...]"})) + Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke ListSnapshots with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46883,20 +55483,40 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -46906,30 +55526,52 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions)`, func() { + Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions)`, func() { version := "2024-06-23" - getBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + listSnapshotsPath := "/snapshots" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) + Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"crn:[...]"})) + Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterface successfully with retries`, func() { + It(`Invoke ListSnapshots successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46939,22 +55581,42 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceWithContext(ctx, getBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -46962,7 +55624,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceWithContext(ctx, getBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -46976,18 +55638,40 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) + Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"crn:[...]"})) + Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke ListSnapshots successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46997,25 +55681,45 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(nil) + result, response, operationErr := vpcService.ListSnapshots(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke ListSnapshots with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47024,41 +55728,153 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerNetworkInterfaceOptions model with no property values - getBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListSnapshots successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("my-name") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.SnapshotCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.SnapshotCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.SnapshotCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"snapshots":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot","service_tags":["ServiceTags"],"size":1,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"user_tags":["UserTags"]}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"snapshots":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"progress":55,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot","service_tags":["ServiceTags"],"size":1,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"user_tags":["UserTags"]}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { + It(`Use SnapshotsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47067,44 +55883,106 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ + Limit: core.Int64Ptr(int64(10)), + Tag: core.StringPtr("testString"), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + SourceVolumeID: core.StringPtr("testString"), + SourceVolumeCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"), + SourceImageID: core.StringPtr("testString"), + SourceImageCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + CopiesID: core.StringPtr("testString"), + CopiesName: core.StringPtr("my-snapshot-copy"), + CopiesCRN: core.StringPtr("crn:[...]"), + CopiesRemoteRegionName: core.StringPtr("us-south"), + SourceSnapshotID: core.StringPtr("testString"), + SourceSnapshotRemoteRegionName: core.StringPtr("us-south"), + SourceVolumeRemoteRegionName: core.StringPtr("us-south"), + SourceImageRemoteRegionName: core.StringPtr("us-south"), + ClonesZoneName: core.StringPtr("us-south-1"), + SnapshotConsistencyGroupID: core.StringPtr("testString"), + SnapshotConsistencyGroupCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"), + } - // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + var allResults []vpcv1.Snapshot + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - AfterEach(func() { - testServer.Close() + It(`Use SnapshotsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ + Limit: core.Int64Ptr(int64(10)), + Tag: core.StringPtr("testString"), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + SourceVolumeID: core.StringPtr("testString"), + SourceVolumeCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"), + SourceImageID: core.StringPtr("testString"), + SourceImageCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + CopiesID: core.StringPtr("testString"), + CopiesName: core.StringPtr("my-snapshot-copy"), + CopiesCRN: core.StringPtr("crn:[...]"), + CopiesRemoteRegionName: core.StringPtr("us-south"), + SourceSnapshotID: core.StringPtr("testString"), + SourceSnapshotRemoteRegionName: core.StringPtr("us-south"), + SourceVolumeRemoteRegionName: core.StringPtr("us-south"), + SourceImageRemoteRegionName: core.StringPtr("us-south"), + ClonesZoneName: core.StringPtr("us-south-1"), + SnapshotConsistencyGroupID: core.StringPtr("testString"), + SnapshotConsistencyGroupCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"), + } + + pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) - Operation response error`, func() { version := "2024-06-23" - updateBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + createSnapshotPath := "/snapshots" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke CreateSnapshot with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47113,30 +55991,43 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -47146,17 +56037,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions)`, func() { + Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions)`, func() { version := "2024-06-23" - updateBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + createSnapshotPath := "/snapshots" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -47181,11 +56072,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke UpdateBareMetalServerNetworkInterface successfully with retries`, func() { + It(`Invoke CreateSnapshot successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47195,32 +56086,45 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateBareMetalServerNetworkInterfaceWithContext(ctx, updateBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -47228,7 +56132,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBareMetalServerNetworkInterfaceWithContext(ctx, updateBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -47242,8 +56146,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -47265,11 +56169,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke CreateSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47279,35 +56183,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(nil) + result, response, operationErr := vpcService.CreateSnapshot(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke CreateSnapshot with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47316,33 +56233,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateBareMetalServerNetworkInterfaceOptions model with no property values - updateBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + // Construct a second instance of the CreateSnapshotOptions model with no property values + createSnapshotOptionsModelNew := new(vpcv1.CreateSnapshotOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -47357,10 +56287,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke CreateSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47369,24 +56299,37 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -47398,16 +56341,93 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { + Describe(`DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions)`, func() { version := "2024-06-23" - listBareMetalServerNetworkInterfaceFloatingIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips" + deleteSnapshotPath := "/snapshots/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteSnapshot successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteSnapshot(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSnapshotOptions model + deleteSnapshotOptionsModel := new(vpcv1.DeleteSnapshotOptions) + deleteSnapshotOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSnapshot(deleteSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSnapshot with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteSnapshotOptions model + deleteSnapshotOptionsModel := new(vpcv1.DeleteSnapshotOptions) + deleteSnapshotOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteSnapshot(deleteSnapshotOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSnapshotOptions model with no property values + deleteSnapshotOptionsModelNew := new(vpcv1.DeleteSnapshotOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSnapshot(deleteSnapshotOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions) - Operation response error`, func() { + version := "2024-06-23" + getSnapshotPath := "/snapshots/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -47416,7 +56436,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { + It(`Invoke GetSnapshot with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47425,20 +56445,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -47448,16 +56467,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions)`, func() { + Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions)`, func() { version := "2024-06-23" - listBareMetalServerNetworkInterfaceFloatingIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips" + getSnapshotPath := "/snapshots/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -47468,10 +56487,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully with retries`, func() { + It(`Invoke GetSnapshot successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47481,22 +56500,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx, listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr := vpcService.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -47504,7 +56522,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx, listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr = vpcService.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -47518,7 +56536,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -47526,10 +56544,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke GetSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47539,25 +56557,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(nil) + result, response, operationErr := vpcService.GetSnapshot(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { + It(`Invoke GetSnapshot with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47566,23 +56583,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model with no property values - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + // Construct a second instance of the GetSnapshotOptions model with no property values + getSnapshotOptionsModelNew := new(vpcv1.GetSnapshotOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModelNew) + result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -47600,7 +56616,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke GetSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47609,14 +56625,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -47628,94 +56643,19 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { - version := "2024-06-23" - removeBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(removeBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke RemoveBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke RemoveBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) - Operation response error`, func() { version := "2024-06-23" - getBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + updateSnapshotPath := "/snapshots/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -47723,7 +56663,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke UpdateSnapshot with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47732,21 +56672,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -47756,18 +56703,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions)`, func() { version := "2024-06-23" - getBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + updateSnapshotPath := "/snapshots/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -47776,10 +56741,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke UpdateSnapshot successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47789,23 +56754,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -47813,7 +56785,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -47827,18 +56799,36 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "progress": 55, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke UpdateSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47848,26 +56838,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.UpdateSnapshot(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke UpdateSnapshot with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47876,24 +56873,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values - getBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the UpdateSnapshotOptions model with no property values + updateSnapshotOptionsModelNew := new(vpcv1.UpdateSnapshotOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -47911,7 +56915,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke UpdateSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47920,15 +56924,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -47940,25 +56951,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) - Operation response error`, func() { version := "2024-06-23" - addBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + listSnapshotClonesPath := "/snapshots/testString/clones" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotClonesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke ListSnapshotClones with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47967,21 +56978,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -47991,17 +57000,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions)`, func() { version := "2024-06-23" - addBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + listSnapshotClonesPath := "/snapshots/testString/clones" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotClonesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -48010,11 +57019,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke ListSnapshotClones successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48024,23 +57033,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.ListSnapshotClonesWithContext(ctx, listSnapshotClonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -48048,7 +57055,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.ListSnapshotClonesWithContext(ctx, listSnapshotClonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -48062,18 +57069,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotClonesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke ListSnapshotClones successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48083,26 +57090,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.ListSnapshotClones(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke ListSnapshotClones with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48111,24 +57116,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values - addBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the ListSnapshotClonesOptions model with no property values + listSnapshotClonesOptionsModelNew := new(vpcv1.ListSnapshotClonesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -48143,10 +57146,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke ListSnapshotClones successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48155,15 +57158,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -48175,16 +57176,91 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) - Operation response error`, func() { + Describe(`DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions)`, func() { + version := "2024-06-23" + deleteSnapshotClonePath := "/snapshots/testString/clones/us-south-1" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotClonePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteSnapshotClone successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteSnapshotClone(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSnapshotCloneOptions model + deleteSnapshotCloneOptionsModel := new(vpcv1.DeleteSnapshotCloneOptions) + deleteSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + deleteSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSnapshotClone with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteSnapshotCloneOptions model + deleteSnapshotCloneOptionsModel := new(vpcv1.DeleteSnapshotCloneOptions) + deleteSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + deleteSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSnapshotCloneOptions model with no property values + deleteSnapshotCloneOptionsModelNew := new(vpcv1.DeleteSnapshotCloneOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) - Operation response error`, func() { version := "2024-06-23" - listBareMetalServerNetworkInterfaceIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/ips" + getSnapshotClonePath := "/snapshots/testString/clones/us-south-1" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotClonePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -48193,7 +57269,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation response processing error`, func() { + It(`Invoke GetSnapshotClone with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48202,20 +57278,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -48225,16 +57301,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions)`, func() { + Describe(`GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions)`, func() { version := "2024-06-23" - listBareMetalServerNetworkInterfaceIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/ips" + getSnapshotClonePath := "/snapshots/testString/clones/us-south-1" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotClonePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -48245,10 +57321,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully with retries`, func() { + It(`Invoke GetSnapshotClone successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48258,22 +57334,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIpsWithContext(ctx, listBareMetalServerNetworkInterfaceIpsOptionsModel) + _, _, operationErr := vpcService.GetSnapshotCloneWithContext(ctx, getSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -48281,7 +57357,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIpsWithContext(ctx, listBareMetalServerNetworkInterfaceIpsOptionsModel) + _, _, operationErr = vpcService.GetSnapshotCloneWithContext(ctx, getSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -48295,7 +57371,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotClonePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -48303,10 +57379,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { + It(`Invoke GetSnapshotClone successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48316,25 +57392,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(nil) + result, response, operationErr := vpcService.GetSnapshotClone(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation validation and request error`, func() { + It(`Invoke GetSnapshotClone with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48343,23 +57419,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListBareMetalServerNetworkInterfaceIpsOptions model with no property values - listBareMetalServerNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) + // Construct a second instance of the GetSnapshotCloneOptions model with no property values + getSnapshotCloneOptionsModelNew := new(vpcv1.GetSnapshotCloneOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModelNew) + result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -48377,7 +57453,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { + It(`Invoke GetSnapshotClone successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48386,14 +57462,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -48405,17 +57481,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) - Operation response error`, func() { + Describe(`CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) - Operation response error`, func() { version := "2024-06-23" - getBareMetalServerNetworkInterfaceIPPath := "/bare_metal_servers/testString/network_interfaces/testString/ips/testString" + createSnapshotClonePath := "/snapshots/testString/clones/us-south-1" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotClonePath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -48423,7 +57499,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation response processing error`, func() { + It(`Invoke CreateSnapshotClone with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48432,21 +57508,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -48456,17 +57531,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions)`, func() { + Describe(`CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions)`, func() { version := "2024-06-23" - getBareMetalServerNetworkInterfaceIPPath := "/bare_metal_servers/testString/network_interfaces/testString/ips/testString" + createSnapshotClonePath := "/snapshots/testString/clones/us-south-1" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotClonePath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -48476,10 +57551,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully with retries`, func() { + It(`Invoke CreateSnapshotClone successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48489,23 +57564,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIPWithContext(ctx, getBareMetalServerNetworkInterfaceIPOptionsModel) + _, _, operationErr := vpcService.CreateSnapshotCloneWithContext(ctx, createSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -48513,7 +57587,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIPWithContext(ctx, getBareMetalServerNetworkInterfaceIPOptionsModel) + _, _, operationErr = vpcService.CreateSnapshotCloneWithContext(ctx, createSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -48527,18 +57601,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotClonePath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { + It(`Invoke CreateSnapshotClone successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48548,26 +57622,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(nil) + result, response, operationErr := vpcService.CreateSnapshotClone(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation validation and request error`, func() { + It(`Invoke CreateSnapshotClone with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48576,24 +57649,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerNetworkInterfaceIPOptions model with no property values - getBareMetalServerNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) + // Construct a second instance of the CreateSnapshotCloneOptions model with no property values + createSnapshotCloneOptionsModelNew := new(vpcv1.CreateSnapshotCloneOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModelNew) + result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -48611,7 +57683,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { + It(`Invoke CreateSnapshotClone successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48620,15 +57692,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") + createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -48640,98 +57711,28 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions)`, func() { - version := "2024-06-23" - deleteBareMetalServerPath := "/bare_metal_servers/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBareMetalServerPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteBareMetalServer successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteBareMetalServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteBareMetalServerOptions model - deleteBareMetalServerOptionsModel := new(vpcv1.DeleteBareMetalServerOptions) - deleteBareMetalServerOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteBareMetalServer with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the DeleteBareMetalServerOptions model - deleteBareMetalServerOptionsModel := new(vpcv1.DeleteBareMetalServerOptions) - deleteBareMetalServerOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteBareMetalServerOptions model with no property values - deleteBareMetalServerOptionsModelNew := new(vpcv1.DeleteBareMetalServerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) - Operation response error`, func() { + Describe(`ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) - Operation response error`, func() { version := "2024-06-23" - getBareMetalServerPath := "/bare_metal_servers/testString" + listShareProfilesPath := "/share/profiles" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) + Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServer with error: Operation response processing error`, func() { + It(`Invoke ListShareProfiles with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48740,19 +57741,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr = vpcService.ListShareProfiles(listShareProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -48762,30 +57765,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions)`, func() { + Describe(`ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions)`, func() { version := "2024-06-23" - getBareMetalServerPath := "/bare_metal_servers/testString" + listShareProfilesPath := "/share/profiles" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) + Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServer successfully with retries`, func() { + It(`Invoke ListShareProfiles successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48795,21 +57801,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerWithContext(ctx, getBareMetalServerOptionsModel) + _, _, operationErr := vpcService.ListShareProfilesWithContext(ctx, listShareProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -48817,7 +57825,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerWithContext(ctx, getBareMetalServerOptionsModel) + _, _, operationErr = vpcService.ListShareProfilesWithContext(ctx, listShareProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -48831,18 +57839,21 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) + Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServer successfully`, func() { + It(`Invoke ListShareProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48852,24 +57863,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServer(nil) + result, response, operationErr := vpcService.ListShareProfiles(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr = vpcService.ListShareProfiles(listShareProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke ListShareProfiles with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48878,25 +57891,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerOptions model with no property values - getBareMetalServerOptionsModelNew := new(vpcv1.GetBareMetalServerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -48911,7 +57919,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBareMetalServer successfully`, func() { + It(`Invoke ListShareProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48920,13 +57928,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -48937,18 +57947,121 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ShareProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ShareProfileCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ShareProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use ShareProfilesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listShareProfilesOptionsModel := &vpcv1.ListShareProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewShareProfilesPager(listShareProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ShareProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ShareProfilesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listShareProfilesOptionsModel := &vpcv1.ListShareProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewShareProfilesPager(listShareProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) - Operation response error`, func() { + Describe(`GetShareProfile(getShareProfileOptions *GetShareProfileOptions) - Operation response error`, func() { version := "2024-06-23" - updateBareMetalServerPath := "/bare_metal_servers/testString" + getShareProfilePath := "/share/profiles/dp2" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getShareProfilePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -48956,7 +58069,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBareMetalServer with error: Operation response processing error`, func() { + It(`Invoke GetShareProfile with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48965,33 +58078,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("dp2") + getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -49001,33 +58100,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions)`, func() { + Describe(`GetShareProfile(getShareProfileOptions *GetShareProfileOptions)`, func() { version := "2024-06-23" - updateBareMetalServerPath := "/bare_metal_servers/testString" + getShareProfilePath := "/share/profiles/dp2" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getShareProfilePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -49037,10 +58120,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}`) })) }) - It(`Invoke UpdateBareMetalServer successfully with retries`, func() { + It(`Invoke GetShareProfile successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49050,35 +58133,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("dp2") + getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateBareMetalServerWithContext(ctx, updateBareMetalServerOptionsModel) + _, _, operationErr := vpcService.GetShareProfileWithContext(ctx, getShareProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -49086,7 +58155,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBareMetalServerWithContext(ctx, updateBareMetalServerOptionsModel) + _, _, operationErr = vpcService.GetShareProfileWithContext(ctx, getShareProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -49100,34 +58169,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getShareProfilePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "firmware": {"update": "none"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}`) })) }) - It(`Invoke UpdateBareMetalServer successfully`, func() { + It(`Invoke GetShareProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49137,38 +58190,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBareMetalServer(nil) + result, response, operationErr := vpcService.GetShareProfile(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("dp2") + getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke GetShareProfile with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49177,36 +58216,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("dp2") + getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateBareMetalServerOptions model with no property values - updateBareMetalServerOptionsModelNew := new(vpcv1.UpdateBareMetalServerOptions) + // Construct a second instance of the GetShareProfileOptions model with no property values + getShareProfileOptionsModelNew := new(vpcv1.GetShareProfileOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModelNew) + result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -49224,7 +58249,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBareMetalServer successfully`, func() { + It(`Invoke GetShareProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49233,27 +58258,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.Bandwidth = core.Int64Ptr(int64(20000)) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("dp2") + getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -49265,116 +58276,31 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions)`, func() { - version := "2024-06-23" - updateFirmwareForBareMetalServerPath := "/bare_metal_servers/testString/firmware/update" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateFirmwareForBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke UpdateFirmwareForBareMetalServer successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.UpdateFirmwareForBareMetalServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the UpdateFirmwareForBareMetalServerOptions model - updateFirmwareForBareMetalServerOptionsModel := new(vpcv1.UpdateFirmwareForBareMetalServerOptions) - updateFirmwareForBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateFirmwareForBareMetalServerOptionsModel.AutoStart = core.BoolPtr(true) - updateFirmwareForBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke UpdateFirmwareForBareMetalServer with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the UpdateFirmwareForBareMetalServerOptions model - updateFirmwareForBareMetalServerOptionsModel := new(vpcv1.UpdateFirmwareForBareMetalServerOptions) - updateFirmwareForBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateFirmwareForBareMetalServerOptionsModel.AutoStart = core.BoolPtr(true) - updateFirmwareForBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the UpdateFirmwareForBareMetalServerOptions model with no property values - updateFirmwareForBareMetalServerOptionsModelNew := new(vpcv1.UpdateFirmwareForBareMetalServerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) - Operation response error`, func() { + Describe(`ListShares(listSharesOptions *ListSharesOptions) - Operation response error`, func() { version := "2024-06-23" - getBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + listSharesPath := "/shares" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerInitialization with error: Operation response processing error`, func() { + It(`Invoke ListShares with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49383,19 +58309,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("my-name") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr = vpcService.ListShares(listSharesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -49405,30 +58336,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions)`, func() { + Describe(`ListShares(listSharesOptions *ListSharesOptions)`, func() { version := "2024-06-23" - getBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + listSharesPath := "/shares" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServerInitialization successfully with retries`, func() { + It(`Invoke ListShares successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49438,21 +58375,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("my-name") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerInitializationWithContext(ctx, getBareMetalServerInitializationOptionsModel) + _, _, operationErr := vpcService.ListSharesWithContext(ctx, listSharesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -49460,7 +58402,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerInitializationWithContext(ctx, getBareMetalServerInitializationOptionsModel) + _, _, operationErr = vpcService.ListSharesWithContext(ctx, listSharesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -49474,18 +58416,24 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServerInitialization successfully`, func() { + It(`Invoke ListShares successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49495,24 +58443,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerInitialization(nil) + result, response, operationErr := vpcService.ListShares(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("my-name") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr = vpcService.ListShares(listSharesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerInitialization with error: Operation validation and request error`, func() { + It(`Invoke ListShares with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49521,25 +58474,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("my-name") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerInitializationOptions model with no property values - getBareMetalServerInitializationOptionsModelNew := new(vpcv1.GetBareMetalServerInitializationOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -49554,7 +58505,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBareMetalServerInitialization successfully`, func() { + It(`Invoke ListShares successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49563,43 +58514,157 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("my-name") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ShareCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ShareCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ShareCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r134-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_transit_encryption_modes":["none"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"origin_share_access_revoked","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"user_tags":["UserTags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r134-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_transit_encryption_modes":["none"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"origin_share_access_revoked","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"user_tags":["UserTags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use SharesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listSharesOptionsModel := &vpcv1.ListSharesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + ReplicationRole: core.StringPtr("none"), + } + + pager, err := vpcService.NewSharesPager(listSharesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Share + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use SharesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listSharesOptionsModel := &vpcv1.ListSharesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + ReplicationRole: core.StringPtr("none"), + } - // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + pager, err := vpcService.NewSharesPager(listSharesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptions *ReplaceBareMetalServerInitializationOptions) - Operation response error`, func() { + Describe(`CreateShare(createShareOptions *CreateShareOptions) - Operation response error`, func() { version := "2024-06-23" - replaceBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + createSharePath := "/shares" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceBareMetalServerInitializationPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(createSharePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ReplaceBareMetalServerInitialization with error: Operation response processing error`, func() { + It(`Invoke CreateShare with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49608,30 +58673,107 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the ReplaceBareMetalServerInitializationOptions model - replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) - replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel - replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + sharePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + result, response, operationErr = vpcService.CreateShare(createShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -49641,17 +58783,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptions *ReplaceBareMetalServerInitializationOptions)`, func() { + Describe(`CreateShare(createShareOptions *CreateShareOptions)`, func() { version := "2024-06-23" - replaceBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + createSharePath := "/shares" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceBareMetalServerInitializationPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(createSharePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -49676,11 +58818,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ReplaceBareMetalServerInitialization successfully with retries`, func() { + It(`Invoke CreateShare successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49690,32 +58832,109 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the ReplaceBareMetalServerInitializationOptions model - replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) - replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel - replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + sharePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ReplaceBareMetalServerInitializationWithContext(ctx, replaceBareMetalServerInitializationOptionsModel) + _, _, operationErr := vpcService.CreateShareWithContext(ctx, createShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -49723,7 +58942,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ReplaceBareMetalServerInitializationWithContext(ctx, replaceBareMetalServerInitializationOptionsModel) + _, _, operationErr = vpcService.CreateShareWithContext(ctx, createShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -49737,8 +58956,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceBareMetalServerInitializationPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(createSharePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -49760,11 +58979,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45", "id": "82679077-ac3b-4c10-be16-63e9c21f0f45", "name": "my-key-1"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ReplaceBareMetalServerInitialization successfully`, func() { + It(`Invoke CreateShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49774,240 +58993,112 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(nil) + result, response, operationErr := vpcService.CreateShare(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the ReplaceBareMetalServerInitializationOptions model - replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) - replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel - replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ReplaceBareMetalServerInitialization with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the ReplaceBareMetalServerInitializationOptions model - replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) - replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel - replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the ReplaceBareMetalServerInitializationOptions model with no property values - replaceBareMetalServerInitializationOptionsModelNew := new(vpcv1.ReplaceBareMetalServerInitializationOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke ReplaceBareMetalServerInitialization successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the ReplaceBareMetalServerInitializationOptions model - replaceBareMetalServerInitializationOptionsModel := new(vpcv1.ReplaceBareMetalServerInitializationOptions) - replaceBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Image = imageIdentityModel - replaceBareMetalServerInitializationOptionsModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - replaceBareMetalServerInitializationOptionsModel.UserData = core.StringPtr("testString") - replaceBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Invoke operation - result, response, operationErr := vpcService.ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions)`, func() { - version := "2024-06-23" - restartBareMetalServerPath := "/bare_metal_servers/testString/restart" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(restartBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke RestartBareMetalServer successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.RestartBareMetalServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - // Construct an instance of the RestartBareMetalServerOptions model - restartBareMetalServerOptionsModel := new(vpcv1.RestartBareMetalServerOptions) - restartBareMetalServerOptionsModel.ID = core.StringPtr("testString") - restartBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke RestartBareMetalServer with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - // Construct an instance of the RestartBareMetalServerOptions model - restartBareMetalServerOptionsModel := new(vpcv1.RestartBareMetalServerOptions) - restartBareMetalServerOptionsModel.ID = core.StringPtr("testString") - restartBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RestartBareMetalServerOptions model with no property values - restartBareMetalServerOptionsModelNew := new(vpcv1.RestartBareMetalServerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions)`, func() { - version := "2024-06-23" - startBareMetalServerPath := "/bare_metal_servers/testString/start" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(startBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke StartBareMetalServer successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.StartBareMetalServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) - // Construct an instance of the StartBareMetalServerOptions model - startBareMetalServerOptionsModel := new(vpcv1.StartBareMetalServerOptions) - startBareMetalServerOptionsModel.ID = core.StringPtr("testString") - startBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + sharePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.StartBareMetalServer(startBareMetalServerOptionsModel) + result, response, operationErr = vpcService.CreateShare(createShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke StartBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke CreateShare with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50016,63 +59107,128 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the StartBareMetalServerOptions model - startBareMetalServerOptionsModel := new(vpcv1.StartBareMetalServerOptions) - startBareMetalServerOptionsModel.ID = core.StringPtr("testString") - startBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + sharePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.StartBareMetalServer(startBareMetalServerOptionsModel) + result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the StartBareMetalServerOptions model with no property values - startBareMetalServerOptionsModelNew := new(vpcv1.StartBareMetalServerOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateShareOptions model with no property values + createShareOptionsModelNew := new(vpcv1.CreateShareOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.StartBareMetalServer(startBareMetalServerOptionsModelNew) + result, response, operationErr = vpcService.CreateShare(createShareOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions)`, func() { - version := "2024-06-23" - stopBareMetalServerPath := "/bare_metal_servers/testString/stop" - Context(`Using mock server endpoint`, func() { + Context(`Using mock server endpoint with missing response body`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(stopBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + // Set success status code with no respoonse body + res.WriteHeader(201) })) }) - It(`Invoke StopBareMetalServer successfully`, func() { + It(`Invoke CreateShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50081,76 +59237,133 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.StopBareMetalServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the StopBareMetalServerOptions model - stopBareMetalServerOptionsModel := new(vpcv1.StopBareMetalServerOptions) - stopBareMetalServerOptionsModel.ID = core.StringPtr("testString") - stopBareMetalServerOptionsModel.Type = core.StringPtr("hard") - stopBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.StopBareMetalServer(stopBareMetalServerOptionsModel) + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + sharePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke StopBareMetalServer with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the StopBareMetalServerOptions model - stopBareMetalServerOptionsModel := new(vpcv1.StopBareMetalServerOptions) - stopBareMetalServerOptionsModel.ID = core.StringPtr("testString") - stopBareMetalServerOptionsModel.Type = core.StringPtr("hard") - stopBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.StopBareMetalServer(stopBareMetalServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the StopBareMetalServerOptions model with no property values - stopBareMetalServerOptionsModelNew := new(vpcv1.StopBareMetalServerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.StopBareMetalServer(stopBareMetalServerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) - Operation response error`, func() { + Describe(`DeleteShare(deleteShareOptions *DeleteShareOptions) - Operation response error`, func() { version := "2024-06-23" - listVolumeProfilesPath := "/volume/profiles" + deleteSharePath := "/shares/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSharePath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListVolumeProfiles with error: Operation response processing error`, func() { + It(`Invoke DeleteShare with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50159,20 +59372,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -50182,32 +59395,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions)`, func() { + Describe(`DeleteShare(deleteShareOptions *DeleteShareOptions)`, func() { version := "2024-06-23" - listVolumeProfilesPath := "/volume/profiles" + deleteSharePath := "/shares/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSharePath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose"}], "total_count": 132}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListVolumeProfiles successfully with retries`, func() { + It(`Invoke DeleteShare successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50217,22 +59430,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListVolumeProfilesWithContext(ctx, listVolumeProfilesOptionsModel) + _, _, operationErr := vpcService.DeleteShareWithContext(ctx, deleteShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -50240,7 +59453,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListVolumeProfilesWithContext(ctx, listVolumeProfilesOptionsModel) + _, _, operationErr = vpcService.DeleteShareWithContext(ctx, deleteShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -50254,20 +59467,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSharePath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose"}], "total_count": 132}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListVolumeProfiles successfully`, func() { + It(`Invoke DeleteShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50277,140 +59490,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListVolumeProfiles(nil) + result, response, operationErr := vpcService.DeleteShare(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVolumeProfiles with error: Operation request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke ListVolumeProfiles successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.VolumeProfileCollection) - nextObject := new(vpcv1.VolumeProfileCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.VolumeProfileCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.VolumeProfileCollection) - nextObject := new(vpcv1.VolumeProfileCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) - Expect(req.Method).To(Equal("GET")) + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"adjustable_capacity_states":{"type":"enum","values":["attached"]},"adjustable_iops_states":{"type":"enum","values":["attached"]},"boot_capacity":{"type":"fixed","value":4800},"capacity":{"type":"fixed","value":4800},"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","iops":{"type":"fixed","value":4000},"name":"general-purpose"}]}`) - } else { - res.WriteHeader(400) - } - })) }) - It(`Use VolumeProfilesPager.GetNext successfully`, func() { + It(`Invoke DeleteShare with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50419,24 +59517,41 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) + // Construct an instance of the DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the DeleteShareOptions model with no property values + deleteShareOptionsModelNew := new(vpcv1.DeleteShareOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - var allResults []vpcv1.VolumeProfile - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Set success status code with no respoonse body + res.WriteHeader(202) + })) }) - It(`Use VolumeProfilesPager.GetAll successfully`, func() { + It(`Invoke DeleteShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50445,31 +59560,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } + // Construct an instance of the DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Invoke operation + result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) - Operation response error`, func() { + Describe(`GetShare(getShareOptions *GetShareOptions) - Operation response error`, func() { version := "2024-06-23" - getVolumeProfilePath := "/volume/profiles/10iops-tier" + getSharePath := "/shares/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + Expect(req.URL.EscapedPath()).To(Equal(getSharePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -50478,7 +59597,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetVolumeProfile with error: Operation response processing error`, func() { + It(`Invoke GetShare with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50487,19 +59606,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr := vpcService.GetShare(getShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr = vpcService.GetShare(getShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -50509,16 +59628,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions)`, func() { + Describe(`GetShare(getShareOptions *GetShareOptions)`, func() { version := "2024-06-23" - getVolumeProfilePath := "/volume/profiles/10iops-tier" + getSharePath := "/shares/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + Expect(req.URL.EscapedPath()).To(Equal(getSharePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -50529,10 +59648,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose"}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetVolumeProfile successfully with retries`, func() { + It(`Invoke GetShare successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50542,21 +59661,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) + _, _, operationErr := vpcService.GetShareWithContext(ctx, getShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr := vpcService.GetShare(getShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -50564,7 +59683,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) + _, _, operationErr = vpcService.GetShareWithContext(ctx, getShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -50578,7 +59697,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + Expect(req.URL.EscapedPath()).To(Equal(getSharePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -50586,10 +59705,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"adjustable_capacity_states": {"type": "enum", "values": ["attached"]}, "adjustable_iops_states": {"type": "enum", "values": ["attached"]}, "boot_capacity": {"type": "fixed", "value": 4800}, "capacity": {"type": "fixed", "value": 4800}, "family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "iops": {"type": "fixed", "value": 4000}, "name": "general-purpose"}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetVolumeProfile successfully`, func() { + It(`Invoke GetShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50599,24 +59718,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetVolumeProfile(nil) + result, response, operationErr := vpcService.GetShare(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr = vpcService.GetShare(getShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetVolumeProfile with error: Operation validation and request error`, func() { + It(`Invoke GetShare with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50625,22 +59744,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr := vpcService.GetShare(getShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetVolumeProfileOptions model with no property values - getVolumeProfileOptionsModelNew := new(vpcv1.GetVolumeProfileOptions) + // Construct a second instance of the GetShareOptions model with no property values + getShareOptionsModelNew := new(vpcv1.GetShareOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModelNew) + result, response, operationErr = vpcService.GetShare(getShareOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -50658,7 +59777,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetVolumeProfile successfully`, func() { + It(`Invoke GetShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50667,13 +59786,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("10iops-tier") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr := vpcService.GetShare(getShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -50685,34 +59804,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions) - Operation response error`, func() { + Describe(`UpdateShare(updateShareOptions *UpdateShareOptions) - Operation response error`, func() { version := "2024-06-23" - listVolumesPath := "/volumes" + updateSharePath := "/shares/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSharePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) - Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) - Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) - Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListVolumes with error: Operation response processing error`, func() { + It(`Invoke UpdateShare with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50721,27 +59833,38 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("my-name") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Tag = core.StringPtr("testString") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) + result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListVolumes(listVolumesOptionsModel) + result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -50751,39 +59874,48 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions)`, func() { + Describe(`UpdateShare(updateShareOptions *UpdateShareOptions)`, func() { version := "2024-06-23" - listVolumesPath := "/volumes" + updateSharePath := "/shares/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSharePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) - Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) - Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) - Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListVolumes successfully with retries`, func() { + It(`Invoke UpdateShare successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50793,29 +59925,40 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("my-name") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Tag = core.StringPtr("testString") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListVolumesWithContext(ctx, listVolumesOptionsModel) + _, _, operationErr := vpcService.UpdateShareWithContext(ctx, updateShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) + result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -50823,7 +59966,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListVolumesWithContext(ctx, listVolumesOptionsModel) + _, _, operationErr = vpcService.UpdateShareWithContext(ctx, updateShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -50837,27 +59980,36 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSharePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) - Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) - Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) - Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132, "volumes": [{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListVolumes successfully`, func() { + It(`Invoke UpdateShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50867,32 +60019,43 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListVolumes(nil) + result, response, operationErr := vpcService.UpdateShare(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("my-name") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Tag = core.StringPtr("testString") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVolumes(listVolumesOptionsModel) + result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListVolumes with error: Operation request error`, func() { + It(`Invoke UpdateShare with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50901,127 +60064,59 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("my-name") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Tag = core.StringPtr("testString") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) + result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke ListVolumes successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("my-name") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Tag = core.StringPtr("testString") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result + // Construct a second instance of the UpdateShareOptions model with no property values + updateShareOptionsModelNew := new(vpcv1.UpdateShareOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.VolumeCollection) - nextObject := new(vpcv1.VolumeCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.VolumeCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.VolumeCollection) - nextObject := new(vpcv1.VolumeCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + Context(`Using mock server endpoint with missing response body`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") + // Set success status code with no respoonse body res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"attachment_state":"attached","bandwidth":1000,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"status":"available","status_reasons":[{"code":"encryption_key_deleted","message":"Message","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"user_tags":["UserTags"],"volume_attachments":[{"delete_volume_on_instance_delete":true,"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a","id":"0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","name":"my-instance"},"name":"my-volume-attachment","type":"boot"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"volumes":[{"active":true,"adjustable_capacity_states":["attached"],"adjustable_iops_states":["attached"],"attachment_state":"attached","bandwidth":1000,"busy":true,"capacity":1000,"catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"allow_user_image_creation":true,"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"status":"available","status_reasons":[{"code":"encryption_key_deleted","message":"Message","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"user_tags":["UserTags"],"volume_attachments":[{"delete_volume_on_instance_delete":true,"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a","id":"0717_1e09281b-f177-46f2-b1f1-bc152b2e391a","name":"my-instance"},"name":"my-volume-attachment","type":"boot"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else { - res.WriteHeader(400) - } })) }) - It(`Use VolumesPager.GetNext successfully`, func() { + It(`Invoke UpdateShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51030,80 +60125,64 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listVolumesOptionsModel := &vpcv1.ListVolumesOptions{ - Limit: core.Int64Ptr(int64(10)), - Name: core.StringPtr("my-name"), - AttachmentState: core.StringPtr("attached"), - Encryption: core.StringPtr("provider_managed"), - OperatingSystemFamily: core.StringPtr("Ubuntu Server"), - OperatingSystemArchitecture: core.StringPtr("amd64"), - ZoneName: core.StringPtr("us-south-1"), - Tag: core.StringPtr("testString"), - } - - pager, err := vpcService.NewVolumesPager(listVolumesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - var allResults []vpcv1.Volume - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use VolumesPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - listVolumesOptionsModel := &vpcv1.ListVolumesOptions{ - Limit: core.Int64Ptr(int64(10)), - Name: core.StringPtr("my-name"), - AttachmentState: core.StringPtr("attached"), - Encryption: core.StringPtr("provider_managed"), - OperatingSystemFamily: core.StringPtr("Ubuntu Server"), - OperatingSystemArchitecture: core.StringPtr("amd64"), - ZoneName: core.StringPtr("us-south-1"), - Tag: core.StringPtr("testString"), - } + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - pager, err := vpcService.NewVolumesPager(listVolumesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Invoke operation + result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions) - Operation response error`, func() { + Describe(`ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) - Operation response error`, func() { version := "2024-06-23" - createVolumePath := "/volumes" + listShareAccessorBindingsPath := "/shares/testString/accessor_bindings" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listShareAccessorBindingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateVolume with error: Operation response processing error`, func() { + It(`Invoke ListShareAccessorBindings with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51112,46 +60191,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("custom") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareAccessorBindingsOptions model + listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) + listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) + result, response, operationErr := vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModel) + result, response, operationErr = vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -51161,46 +60215,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions)`, func() { + Describe(`ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions)`, func() { version := "2024-06-23" - createVolumePath := "/volumes" + listShareAccessorBindingsPath := "/shares/testString/accessor_bindings" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listShareAccessorBindingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke CreateVolume successfully with retries`, func() { + It(`Invoke ListShareAccessorBindings successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51210,48 +60250,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("custom") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareAccessorBindingsOptions model + listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) + listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateVolumeWithContext(ctx, createVolumeOptionsModel) + _, _, operationErr := vpcService.ListShareAccessorBindingsWithContext(ctx, listShareAccessorBindingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) + result, response, operationErr := vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -51259,7 +60274,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateVolumeWithContext(ctx, createVolumeOptionsModel) + _, _, operationErr = vpcService.ListShareAccessorBindingsWithContext(ctx, listShareAccessorBindingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -51273,34 +60288,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listShareAccessorBindingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke CreateVolume successfully`, func() { + It(`Invoke ListShareAccessorBindings successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51310,51 +60311,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateVolume(nil) + result, response, operationErr := vpcService.ListShareAccessorBindings(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("custom") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareAccessorBindingsOptions model + listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) + listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModel) + result, response, operationErr = vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateVolume with error: Operation validation and request error`, func() { + It(`Invoke ListShareAccessorBindings with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51363,49 +60339,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("custom") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareAccessorBindingsOptions model + listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) + listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) + result, response, operationErr := vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateVolumeOptions model with no property values - createVolumeOptionsModelNew := new(vpcv1.CreateVolumeOptions) + // Construct a second instance of the ListShareAccessorBindingsOptions model with no property values + listShareAccessorBindingsOptionsModelNew := new(vpcv1.ListShareAccessorBindingsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModelNew) + result, response, operationErr = vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -51420,10 +60371,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateVolume successfully`, func() { + It(`Invoke ListShareAccessorBindings successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51432,40 +60383,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("custom") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareAccessorBindingsOptions model + listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) + listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") + listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) + result, response, operationErr := vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -51476,27 +60402,128 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ShareAccessorBindingCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ShareAccessorBindingCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ShareAccessorBindingCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listShareAccessorBindingsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r134-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r134-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use ShareAccessorBindingsPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listShareAccessorBindingsOptionsModel := &vpcv1.ListShareAccessorBindingsOptions{ + ID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewShareAccessorBindingsPager(listShareAccessorBindingsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ShareAccessorBinding + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ShareAccessorBindingsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listShareAccessorBindingsOptionsModel := &vpcv1.ListShareAccessorBindingsOptions{ + ID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewShareAccessorBindingsPager(listShareAccessorBindingsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions)`, func() { + Describe(`DeleteShareAccessorBinding(deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions)`, func() { version := "2024-06-23" - deleteVolumePath := "/volumes/testString" + deleteShareAccessorBindingPath := "/shares/testString/accessor_bindings/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteShareAccessorBindingPath)) Expect(req.Method).To(Equal("DELETE")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.WriteHeader(204) })) }) - It(`Invoke DeleteVolume successfully`, func() { + It(`Invoke DeleteShareAccessorBinding successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51506,22 +60533,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteVolume(nil) + response, operationErr := vpcService.DeleteShareAccessorBinding(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteVolumeOptions model - deleteVolumeOptionsModel := new(vpcv1.DeleteVolumeOptions) - deleteVolumeOptionsModel.ID = core.StringPtr("testString") - deleteVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareAccessorBindingOptions model + deleteShareAccessorBindingOptionsModel := new(vpcv1.DeleteShareAccessorBindingOptions) + deleteShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") + deleteShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") + deleteShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVolume(deleteVolumeOptionsModel) + response, operationErr = vpcService.DeleteShareAccessorBinding(deleteShareAccessorBindingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteVolume with error: Operation validation and request error`, func() { + It(`Invoke DeleteShareAccessorBinding with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51530,22 +60557,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteVolumeOptions model - deleteVolumeOptionsModel := new(vpcv1.DeleteVolumeOptions) - deleteVolumeOptionsModel.ID = core.StringPtr("testString") - deleteVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareAccessorBindingOptions model + deleteShareAccessorBindingOptionsModel := new(vpcv1.DeleteShareAccessorBindingOptions) + deleteShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") + deleteShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") + deleteShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteVolume(deleteVolumeOptionsModel) + response, operationErr := vpcService.DeleteShareAccessorBinding(deleteShareAccessorBindingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVolumeOptions model with no property values - deleteVolumeOptionsModelNew := new(vpcv1.DeleteVolumeOptions) + // Construct a second instance of the DeleteShareAccessorBindingOptions model with no property values + deleteShareAccessorBindingOptionsModelNew := new(vpcv1.DeleteShareAccessorBindingOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVolume(deleteVolumeOptionsModelNew) + response, operationErr = vpcService.DeleteShareAccessorBinding(deleteShareAccessorBindingOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -51554,16 +60581,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVolume(getVolumeOptions *GetVolumeOptions) - Operation response error`, func() { + Describe(`GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions) - Operation response error`, func() { version := "2024-06-23" - getVolumePath := "/volumes/testString" + getShareAccessorBindingPath := "/shares/testString/accessor_bindings/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(getShareAccessorBindingPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -51572,7 +60599,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetVolume with error: Operation response processing error`, func() { + It(`Invoke GetShareAccessorBinding with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51581,19 +60608,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareAccessorBindingOptions model + getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) + getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr := vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr = vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -51603,16 +60631,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVolume(getVolumeOptions *GetVolumeOptions)`, func() { + Describe(`GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions)`, func() { version := "2024-06-23" - getVolumePath := "/volumes/testString" + getShareAccessorBindingPath := "/shares/testString/accessor_bindings/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(getShareAccessorBindingPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -51623,10 +60651,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}`) })) }) - It(`Invoke GetVolume successfully with retries`, func() { + It(`Invoke GetShareAccessorBinding successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51636,21 +60664,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareAccessorBindingOptions model + getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) + getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetVolumeWithContext(ctx, getVolumeOptionsModel) + _, _, operationErr := vpcService.GetShareAccessorBindingWithContext(ctx, getShareAccessorBindingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr := vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -51658,7 +60687,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetVolumeWithContext(ctx, getVolumeOptionsModel) + _, _, operationErr = vpcService.GetShareAccessorBindingWithContext(ctx, getShareAccessorBindingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -51672,7 +60701,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(getShareAccessorBindingPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -51680,10 +60709,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}`) })) }) - It(`Invoke GetVolume successfully`, func() { + It(`Invoke GetShareAccessorBinding successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51693,24 +60722,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetVolume(nil) + result, response, operationErr := vpcService.GetShareAccessorBinding(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareAccessorBindingOptions model + getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) + getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr = vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetVolume with error: Operation validation and request error`, func() { + It(`Invoke GetShareAccessorBinding with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51719,22 +60749,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareAccessorBindingOptions model + getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) + getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr := vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetVolumeOptions model with no property values - getVolumeOptionsModelNew := new(vpcv1.GetVolumeOptions) + // Construct a second instance of the GetShareAccessorBindingOptions model with no property values + getShareAccessorBindingOptionsModelNew := new(vpcv1.GetShareAccessorBindingOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModelNew) + result, response, operationErr = vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -51752,7 +60783,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetVolume successfully`, func() { + It(`Invoke GetShareAccessorBinding successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51761,13 +60792,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareAccessorBindingOptions model + getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) + getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") + getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr := vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -51779,178 +60811,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) - Operation response error`, func() { - version := "2024-06-23" - updateVolumePath := "/volumes/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke UpdateVolume with error: Operation response processing error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions)`, func() { + Describe(`FailoverShare(failoverShareOptions *FailoverShareOptions)`, func() { version := "2024-06-23" - updateVolumePath := "/volumes/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateVolume successfully with retries`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := vpcService.UpdateVolumeWithContext(ctx, updateVolumeOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = vpcService.UpdateVolumeWithContext(ctx, updateVolumeOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - }) - AfterEach(func() { - testServer.Close() - }) - }) + failoverSharePath := "/shares/testString/failover" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(failoverSharePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -51968,17 +60839,12 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "adjustable_capacity_states": ["attached"], "adjustable_iops_states": ["attached"], "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46f2-b1f1-bc152b2e391a/volume_attachments/0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "0717-82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(202) })) }) - It(`Invoke UpdateVolume successfully`, func() { + It(`Invoke FailoverShare successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51988,40 +60854,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateVolume(nil) + response, operationErr := vpcService.FailoverShare(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the FailoverShareOptions model + failoverShareOptionsModel := new(vpcv1.FailoverShareOptions) + failoverShareOptionsModel.ShareID = core.StringPtr("testString") + failoverShareOptionsModel.FallbackPolicy = core.StringPtr("fail") + failoverShareOptionsModel.Timeout = core.Int64Ptr(int64(600)) + failoverShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) + response, operationErr = vpcService.FailoverShare(failoverShareOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke UpdateVolume with error: Operation validation and request error`, func() { + It(`Invoke FailoverShare with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52030,123 +60879,53 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the FailoverShareOptions model + failoverShareOptionsModel := new(vpcv1.FailoverShareOptions) + failoverShareOptionsModel.ShareID = core.StringPtr("testString") + failoverShareOptionsModel.FallbackPolicy = core.StringPtr("fail") + failoverShareOptionsModel.Timeout = core.Int64Ptr(int64(600)) + failoverShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) + response, operationErr := vpcService.FailoverShare(failoverShareOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the UpdateVolumeOptions model with no property values - updateVolumeOptionsModelNew := new(vpcv1.UpdateVolumeOptions) + // Construct a second instance of the FailoverShareOptions model with no property values + failoverShareOptionsModelNew := new(vpcv1.FailoverShareOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModelNew) + response, operationErr = vpcService.FailoverShare(failoverShareOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke UpdateVolume successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) - Operation response error`, func() { + Describe(`ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) - Operation response error`, func() { version := "2024-06-23" - listSnapshotConsistencyGroupsPath := "/snapshot_consistency_groups" + listShareMountTargetsPath := "/shares/testString/mount_targets" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSnapshotConsistencyGroups with error: Operation response processing error`, func() { + It(`Invoke ListShareMountTargets with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52155,24 +60934,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -52182,36 +60959,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions)`, func() { + Describe(`ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions)`, func() { version := "2024-06-23" - listSnapshotConsistencyGroupsPath := "/snapshot_consistency_groups" + listShareMountTargetsPath := "/shares/testString/mount_targets" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshot_consistency_groups": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListSnapshotConsistencyGroups successfully with retries`, func() { + It(`Invoke ListShareMountTargets successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52221,26 +60995,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListSnapshotConsistencyGroupsWithContext(ctx, listSnapshotConsistencyGroupsOptionsModel) + _, _, operationErr := vpcService.ListShareMountTargetsWithContext(ctx, listShareMountTargetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -52248,7 +61020,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListSnapshotConsistencyGroupsWithContext(ctx, listSnapshotConsistencyGroupsOptionsModel) + _, _, operationErr = vpcService.ListShareMountTargetsWithContext(ctx, listShareMountTargetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -52262,24 +61034,21 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshot_consistency_groups": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListSnapshotConsistencyGroups successfully`, func() { + It(`Invoke ListShareMountTargets successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52289,29 +61058,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(nil) + result, response, operationErr := vpcService.ListShareMountTargets(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSnapshotConsistencyGroups with error: Operation request error`, func() { + It(`Invoke ListShareMountTargets with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52320,23 +61087,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ListShareMountTargetsOptions model with no property values + listShareMountTargetsOptionsModelNew := new(vpcv1.ListShareMountTargetsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -52351,7 +61123,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListSnapshotConsistencyGroups successfully`, func() { + It(`Invoke ListShareMountTargets successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52360,18 +61132,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -52384,8 +61154,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) - nextObject := new(vpcv1.SnapshotConsistencyGroupCollectionNext) + responseObject := new(vpcv1.ShareMountTargetCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -52394,15 +61164,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) + responseObject := new(vpcv1.ShareMountTargetCollection) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) - nextObject := new(vpcv1.SnapshotConsistencyGroupCollectionNext) + responseObject := new(vpcv1.ShareMountTargetCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -52418,7 +61188,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -52426,15 +61196,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"snapshot_consistency_groups":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["ServiceTags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"snapshot_consistency_groups":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["ServiceTags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use SnapshotConsistencyGroupsPager.GetNext successfully`, func() { + It(`Use ShareMountTargetsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52443,19 +61213,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listSnapshotConsistencyGroupsOptionsModel := &vpcv1.ListSnapshotConsistencyGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), + listShareMountTargetsOptionsModel := &vpcv1.ListShareMountTargetsOptions{ + ShareID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewSnapshotConsistencyGroupsPager(listSnapshotConsistencyGroupsOptionsModel) + pager, err := vpcService.NewShareMountTargetsPager(listShareMountTargetsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.SnapshotConsistencyGroup + var allResults []vpcv1.ShareMountTarget for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -52464,7 +61232,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use SnapshotConsistencyGroupsPager.GetAll successfully`, func() { + It(`Use ShareMountTargetsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52473,15 +61241,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listSnapshotConsistencyGroupsOptionsModel := &vpcv1.ListSnapshotConsistencyGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), + listShareMountTargetsOptionsModel := &vpcv1.ListShareMountTargetsOptions{ + ShareID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewSnapshotConsistencyGroupsPager(listSnapshotConsistencyGroupsOptionsModel) + pager, err := vpcService.NewShareMountTargetsPager(listShareMountTargetsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -52492,16 +61258,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) - Operation response error`, func() { + Describe(`CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) - Operation response error`, func() { version := "2024-06-23" - createSnapshotConsistencyGroupPath := "/snapshot_consistency_groups" + createShareMountTargetPath := "/shares/testString/mount_targets" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createShareMountTargetPath)) Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -52510,7 +61276,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSnapshotConsistencyGroup with error: Operation response processing error`, func() { + It(`Invoke CreateShareMountTarget with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52519,40 +61285,63 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model - snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) - snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel - snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -52562,16 +61351,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions)`, func() { + Describe(`CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions)`, func() { version := "2024-06-23" - createSnapshotConsistencyGroupPath := "/snapshot_consistency_groups" + createShareMountTargetPath := "/shares/testString/mount_targets" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createShareMountTargetPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -52598,10 +61387,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke CreateSnapshotConsistencyGroup successfully with retries`, func() { + It(`Invoke CreateShareMountTarget successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52611,42 +61400,65 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model - snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) - snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel - snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateSnapshotConsistencyGroupWithContext(ctx, createSnapshotConsistencyGroupOptionsModel) + _, _, operationErr := vpcService.CreateShareMountTargetWithContext(ctx, createShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -52654,7 +61466,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateSnapshotConsistencyGroupWithContext(ctx, createSnapshotConsistencyGroupOptionsModel) + _, _, operationErr = vpcService.CreateShareMountTargetWithContext(ctx, createShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -52668,7 +61480,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createShareMountTargetPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -52692,10 +61504,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke CreateSnapshotConsistencyGroup successfully`, func() { + It(`Invoke CreateShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52705,312 +61517,68 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(nil) + result, response, operationErr := vpcService.CreateShareMountTarget(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model - snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) - snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel - snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} - - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateSnapshotConsistencyGroup with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model - snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) - snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel - snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} - - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the CreateSnapshotConsistencyGroupOptions model with no property values - createSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Set success status code with no respoonse body - res.WriteHeader(201) - })) - }) - It(`Invoke CreateSnapshotConsistencyGroup successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotConsistencyGroupContext model - snapshotPrototypeSnapshotConsistencyGroupContextModel := new(vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext) - snapshotPrototypeSnapshotConsistencyGroupContextModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeSnapshotConsistencyGroupContextModel.SourceVolume = volumeIdentityModel - snapshotPrototypeSnapshotConsistencyGroupContextModel.UserTags = []string{"testString"} - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{*snapshotPrototypeSnapshotConsistencyGroupContextModel} - - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) - Operation response error`, func() { - version := "2024-06-23" - deleteSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("DELETE")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke DeleteSnapshotConsistencyGroup with error: Operation response processing error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions)`, func() { - version := "2024-06-23" - deleteSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) - })) - }) - It(`Invoke DeleteSnapshotConsistencyGroup successfully with retries`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := vpcService.DeleteSnapshotConsistencyGroupWithContext(ctx, deleteSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = vpcService.DeleteSnapshotConsistencyGroupWithContext(ctx, deleteSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) - })) - }) - It(`Invoke DeleteSnapshotConsistencyGroup successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteSnapshotConsistencyGroup with error: Operation validation and request error`, func() { + It(`Invoke CreateShareMountTarget with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53019,22 +61587,66 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeleteSnapshotConsistencyGroupOptions model with no property values - deleteSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + // Construct a second instance of the CreateShareMountTargetOptions model with no property values + createShareMountTargetOptionsModelNew := new(vpcv1.CreateShareMountTargetOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModelNew) + result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -53049,10 +61661,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(201) })) }) - It(`Invoke DeleteSnapshotConsistencyGroup successfully`, func() { + It(`Invoke CreateShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53061,13 +61673,57 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -53079,25 +61735,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) - Operation response error`, func() { + Describe(`DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) - Operation response error`, func() { version := "2024-06-23" - getSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + deleteShareMountTargetPath := "/shares/testString/mount_targets/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSnapshotConsistencyGroup with error: Operation response processing error`, func() { + It(`Invoke DeleteShareMountTarget with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53106,19 +61762,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -53128,17 +61785,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions)`, func() { + Describe(`DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions)`, func() { version := "2024-06-23" - getSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + deleteShareMountTargetPath := "/shares/testString/mount_targets/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -53147,11 +61804,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke GetSnapshotConsistencyGroup successfully with retries`, func() { + It(`Invoke DeleteShareMountTarget successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53161,21 +61818,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetSnapshotConsistencyGroupWithContext(ctx, getSnapshotConsistencyGroupOptionsModel) + _, _, operationErr := vpcService.DeleteShareMountTargetWithContext(ctx, deleteShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -53183,7 +61841,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetSnapshotConsistencyGroupWithContext(ctx, getSnapshotConsistencyGroupOptionsModel) + _, _, operationErr = vpcService.DeleteShareMountTargetWithContext(ctx, deleteShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -53197,18 +61855,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke GetSnapshotConsistencyGroup successfully`, func() { + It(`Invoke DeleteShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53218,24 +61876,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(nil) + result, response, operationErr := vpcService.DeleteShareMountTarget(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSnapshotConsistencyGroup with error: Operation validation and request error`, func() { + It(`Invoke DeleteShareMountTarget with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53244,22 +61903,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSnapshotConsistencyGroupOptions model with no property values - getSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.GetSnapshotConsistencyGroupOptions) + // Construct a second instance of the DeleteShareMountTargetOptions model with no property values + deleteShareMountTargetOptionsModelNew := new(vpcv1.DeleteShareMountTargetOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModelNew) + result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -53274,10 +61934,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke GetSnapshotConsistencyGroup successfully`, func() { + It(`Invoke DeleteShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53286,13 +61946,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -53304,19 +61965,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) - Operation response error`, func() { + Describe(`GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) - Operation response error`, func() { version := "2024-06-23" - updateSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + getShareMountTargetPath := "/shares/testString/mount_targets/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.EscapedPath()).To(Equal(getShareMountTargetPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -53324,7 +61983,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateSnapshotConsistencyGroup with error: Operation response processing error`, func() { + It(`Invoke GetShareMountTarget with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53333,28 +61992,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -53364,36 +62015,18 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions)`, func() { + Describe(`GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions)`, func() { version := "2024-06-23" - updateSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + getShareMountTargetPath := "/shares/testString/mount_targets/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getShareMountTargetPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -53402,10 +62035,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke UpdateSnapshotConsistencyGroup successfully with retries`, func() { + It(`Invoke GetShareMountTarget successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53415,30 +62048,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateSnapshotConsistencyGroupWithContext(ctx, updateSnapshotConsistencyGroupOptionsModel) + _, _, operationErr := vpcService.GetShareMountTargetWithContext(ctx, getShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -53446,7 +62071,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateSnapshotConsistencyGroupWithContext(ctx, updateSnapshotConsistencyGroupOptionsModel) + _, _, operationErr = vpcService.GetShareMountTargetWithContext(ctx, getShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -53460,36 +62085,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getShareMountTargetPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke UpdateSnapshotConsistencyGroup successfully`, func() { + It(`Invoke GetShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53499,33 +62106,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(nil) + result, response, operationErr := vpcService.GetShareMountTarget(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateSnapshotConsistencyGroup with error: Operation validation and request error`, func() { + It(`Invoke GetShareMountTarget with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53534,31 +62133,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateSnapshotConsistencyGroupOptions model with no property values - updateSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + // Construct a second instance of the GetShareMountTargetOptions model with no property values + getShareMountTargetOptionsModelNew := new(vpcv1.GetShareMountTargetOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModelNew) + result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -53576,61 +62167,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateSnapshotConsistencyGroup successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions)`, func() { - version := "2024-06-23" - deleteSnapshotsPath := "/snapshots" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotsPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteSnapshots successfully`, func() { + It(`Invoke GetShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53639,94 +62176,44 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteSnapshots(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSnapshotsOptions model - deleteSnapshotsOptionsModel := new(vpcv1.DeleteSnapshotsOptions) - deleteSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - deleteSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSnapshots(deleteSnapshotsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSnapshots with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the DeleteSnapshotsOptions model - deleteSnapshotsOptionsModel := new(vpcv1.DeleteSnapshotsOptions) - deleteSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - deleteSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteSnapshots(deleteSnapshotsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSnapshotsOptions model with no property values - deleteSnapshotsOptionsModelNew := new(vpcv1.DeleteSnapshotsOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSnapshots(deleteSnapshotsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + // Invoke operation + result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) - Operation response error`, func() { + Describe(`UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) - Operation response error`, func() { version := "2024-06-23" - listSnapshotsPath := "/snapshots" + updateShareMountTargetPath := "/shares/testString/mount_targets/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) - Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"crn:[...]"})) - Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSnapshots with error: Operation response processing error`, func() { + It(`Invoke UpdateShareMountTarget with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53735,40 +62222,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -53778,52 +62252,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions)`, func() { + Describe(`UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions)`, func() { version := "2024-06-23" - listSnapshotsPath := "/snapshots" + updateShareMountTargetPath := "/shares/testString/mount_targets/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) - Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"crn:[...]"})) - Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke ListSnapshots successfully with retries`, func() { + It(`Invoke UpdateShareMountTarget successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53833,42 +62301,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) + _, _, operationErr := vpcService.UpdateShareMountTargetWithContext(ctx, updateShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -53876,7 +62331,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) + _, _, operationErr = vpcService.UpdateShareMountTargetWithContext(ctx, updateShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -53890,40 +62345,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) - Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"crn:[...]"})) - Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) - It(`Invoke ListSnapshots successfully`, func() { + It(`Invoke UpdateShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53933,45 +62382,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListSnapshots(nil) + result, response, operationErr := vpcService.UpdateShareMountTarget(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSnapshots with error: Operation request error`, func() { + It(`Invoke UpdateShareMountTarget with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53980,39 +62416,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the UpdateShareMountTargetOptions model with no property values + updateShareMountTargetOptionsModelNew := new(vpcv1.UpdateShareMountTargetOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -54027,7 +62457,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListSnapshots successfully`, func() { + It(`Invoke UpdateShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54036,34 +62466,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("my-name") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("crn:[...]") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -54074,59 +62491,25 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.SnapshotCollection) - nextObject := new(vpcv1.SnapshotCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.SnapshotCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.SnapshotCollection) - nextObject := new(vpcv1.SnapshotCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions)`, func() { + version := "2024-06-23" + deleteShareSourcePath := "/shares/testString/source" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteShareSourcePath)) + Expect(req.Method).To(Equal("DELETE")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"snapshots":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot","service_tags":["ServiceTags"],"size":1,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"user_tags":["UserTags"]}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"snapshots":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","catalog_offering":{"plan":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"}},"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"allow_user_image_creation":true,"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64","name":"ubuntu-24-04-amd64","user_data_format":"cloud_init","vendor":"Canonical","version":"16.04 LTS"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot","service_tags":["ServiceTags"],"size":1,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"user_tags":["UserTags"]}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) })) }) - It(`Use SnapshotsPager.GetNext successfully`, func() { + It(`Invoke DeleteShareSource successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54135,44 +62518,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ - Limit: core.Int64Ptr(int64(10)), - Tag: core.StringPtr("testString"), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - SourceVolumeID: core.StringPtr("testString"), - SourceVolumeCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"), - SourceImageID: core.StringPtr("testString"), - SourceImageCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), - CopiesID: core.StringPtr("testString"), - CopiesName: core.StringPtr("my-snapshot-copy"), - CopiesCRN: core.StringPtr("crn:[...]"), - CopiesRemoteRegionName: core.StringPtr("us-south"), - SourceSnapshotID: core.StringPtr("testString"), - SourceSnapshotRemoteRegionName: core.StringPtr("us-south"), - SourceVolumeRemoteRegionName: core.StringPtr("us-south"), - SourceImageRemoteRegionName: core.StringPtr("us-south"), - ClonesZoneName: core.StringPtr("us-south-1"), - SnapshotConsistencyGroupID: core.StringPtr("testString"), - SnapshotConsistencyGroupCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"), - } + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteShareSource(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the DeleteShareSourceOptions model + deleteShareSourceOptionsModel := new(vpcv1.DeleteShareSourceOptions) + deleteShareSourceOptionsModel.ShareID = core.StringPtr("testString") + deleteShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - var allResults []vpcv1.Snapshot - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteShareSource(deleteShareSourceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) }) - It(`Use SnapshotsPager.GetAll successfully`, func() { + It(`Invoke DeleteShareSource with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54181,60 +62542,48 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ - Limit: core.Int64Ptr(int64(10)), - Tag: core.StringPtr("testString"), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - SourceVolumeID: core.StringPtr("testString"), - SourceVolumeCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"), - SourceImageID: core.StringPtr("testString"), - SourceImageCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), - CopiesID: core.StringPtr("testString"), - CopiesName: core.StringPtr("my-snapshot-copy"), - CopiesCRN: core.StringPtr("crn:[...]"), - CopiesRemoteRegionName: core.StringPtr("us-south"), - SourceSnapshotID: core.StringPtr("testString"), - SourceSnapshotRemoteRegionName: core.StringPtr("us-south"), - SourceVolumeRemoteRegionName: core.StringPtr("us-south"), - SourceImageRemoteRegionName: core.StringPtr("us-south"), - ClonesZoneName: core.StringPtr("us-south-1"), - SnapshotConsistencyGroupID: core.StringPtr("testString"), - SnapshotConsistencyGroupCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"), - } - - pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() + // Construct an instance of the DeleteShareSourceOptions model + deleteShareSourceOptionsModel := new(vpcv1.DeleteShareSourceOptions) + deleteShareSourceOptionsModel.ShareID = core.StringPtr("testString") + deleteShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + response, operationErr := vpcService.DeleteShareSource(deleteShareSourceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteShareSourceOptions model with no property values + deleteShareSourceOptionsModelNew := new(vpcv1.DeleteShareSourceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteShareSource(deleteShareSourceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) - Operation response error`, func() { + Describe(`GetShareSource(getShareSourceOptions *GetShareSourceOptions) - Operation response error`, func() { version := "2024-06-23" - createSnapshotPath := "/snapshots" + getShareSourcePath := "/shares/testString/source" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSnapshot with error: Operation response processing error`, func() { + It(`Invoke GetShareSource with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54243,43 +62592,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel - - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -54289,33 +62614,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions)`, func() { + Describe(`GetShareSource(getShareSourceOptions *GetShareSourceOptions)`, func() { version := "2024-06-23" - createSnapshotPath := "/snapshots" + getShareSourcePath := "/shares/testString/source" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -54324,11 +62633,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}`) })) }) - It(`Invoke CreateSnapshot successfully with retries`, func() { + It(`Invoke GetShareSource successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54338,45 +62647,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel - - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) + _, _, operationErr := vpcService.GetShareSourceWithContext(ctx, getShareSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -54384,7 +62669,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) + _, _, operationErr = vpcService.GetShareSourceWithContext(ctx, getShareSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -54398,34 +62683,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}`) })) }) - It(`Invoke CreateSnapshot successfully`, func() { + It(`Invoke GetShareSource successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54435,48 +62704,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateSnapshot(nil) + result, response, operationErr := vpcService.GetShareSource(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel - - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSnapshot with error: Operation validation and request error`, func() { + It(`Invoke GetShareSource with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54485,46 +62730,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel - - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateSnapshotOptions model with no property values - createSnapshotOptionsModelNew := new(vpcv1.CreateSnapshotOptions) + // Construct a second instance of the GetShareSourceOptions model with no property values + getShareSourceOptionsModelNew := new(vpcv1.GetShareSourceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModelNew) + result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -54539,10 +62760,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateSnapshot successfully`, func() { + It(`Invoke GetShareSource successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54551,37 +62772,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel - - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -54593,102 +62790,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions)`, func() { - version := "2024-06-23" - deleteSnapshotPath := "/snapshots/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteSnapshot successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteSnapshot(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSnapshotOptions model - deleteSnapshotOptionsModel := new(vpcv1.DeleteSnapshotOptions) - deleteSnapshotOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSnapshot(deleteSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSnapshot with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the DeleteSnapshotOptions model - deleteSnapshotOptionsModel := new(vpcv1.DeleteSnapshotOptions) - deleteSnapshotOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteSnapshot(deleteSnapshotOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSnapshotOptions model with no property values - deleteSnapshotOptionsModelNew := new(vpcv1.DeleteSnapshotOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSnapshot(deleteSnapshotOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions) - Operation response error`, func() { + Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) - Operation response error`, func() { version := "2024-06-23" - getSnapshotPath := "/snapshots/testString" + listBackupPoliciesPath := "/backup_policies" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSnapshot with error: Operation response processing error`, func() { + It(`Invoke ListBackupPolicies with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54697,19 +62822,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -54719,30 +62848,35 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions)`, func() { + Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions)`, func() { version := "2024-06-23" - getSnapshotPath := "/snapshots/testString" + listBackupPoliciesPath := "/backup_policies" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + fmt.Fprintf(res, "%s", `{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke GetSnapshot successfully with retries`, func() { + It(`Invoke ListBackupPolicies successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54752,21 +62886,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) + _, _, operationErr := vpcService.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -54774,7 +62912,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) + _, _, operationErr = vpcService.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -54788,18 +62926,23 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + fmt.Fprintf(res, "%s", `{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke GetSnapshot successfully`, func() { + It(`Invoke ListBackupPolicies successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54809,24 +62952,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetSnapshot(nil) + result, response, operationErr := vpcService.ListBackupPolicies(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSnapshot with error: Operation validation and request error`, func() { + It(`Invoke ListBackupPolicies with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54835,25 +62982,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSnapshotOptions model with no property values - getSnapshotOptionsModelNew := new(vpcv1.GetSnapshotOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -54868,7 +63012,89 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSnapshot successfully`, func() { + It(`Invoke ListBackupPolicies successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BackupPolicyCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.BackupPolicyCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.BackupPolicyCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r134-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","match_user_tags":["MatchUserTags"],"name":"my-backup-policy","plans":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"backup_policy","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r134-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","match_user_tags":["MatchUserTags"],"name":"my-backup-policy","plans":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"backup_policy","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"ebc2b430240943458b9e91e1432cfcce","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use BackupPoliciesPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54877,45 +63103,72 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + listBackupPoliciesOptionsModel := &vpcv1.ListBackupPoliciesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Tag: core.StringPtr("testString"), + } - // Invoke operation - result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + var allResults []vpcv1.BackupPolicyIntf + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - AfterEach(func() { - testServer.Close() + It(`Use BackupPoliciesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listBackupPoliciesOptionsModel := &vpcv1.ListBackupPoliciesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Tag: core.StringPtr("testString"), + } + + pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) - Operation response error`, func() { + Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) - Operation response error`, func() { version := "2024-06-23" - updateSnapshotPath := "/snapshots/testString" + createBackupPolicyPath := "/backup_policies" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateSnapshot with error: Operation response processing error`, func() { + It(`Invoke CreateBackupPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54924,28 +63177,75 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -54955,17 +63255,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions)`, func() { + Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions)`, func() { version := "2024-06-23" - updateSnapshotPath := "/snapshots/testString" + createBackupPolicyPath := "/backup_policies" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -54983,8 +63283,6 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -54992,11 +63290,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke UpdateSnapshot successfully with retries`, func() { + It(`Invoke CreateBackupPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55006,30 +63304,77 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) + _, _, operationErr := vpcService.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -55037,7 +63382,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) + _, _, operationErr = vpcService.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -55051,8 +63396,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -55070,17 +63415,15 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "catalog_offering": {"plan": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:51c9e0db-2911-45a6-adb0-ac5332d27cf2:plan:sw.51c9e0db-2911-45a6-adb0-ac5332d27cf2.772c0dbe-aa62-482e-adbe-a3fc20101e0e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}}, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/aa2432b1fa4d4ace891e9b80fc104e34:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"allow_user_image_creation": true, "architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-24-04-amd64", "name": "ubuntu-24-04-amd64", "user_data_format": "cloud_init", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::image:r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "r006-72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke UpdateSnapshot successfully`, func() { + It(`Invoke CreateBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55090,33 +63433,80 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateSnapshot(nil) + result, response, operationErr := vpcService.CreateBackupPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateSnapshot with error: Operation validation and request error`, func() { + It(`Invoke CreateBackupPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55125,31 +63515,78 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateSnapshotOptions model with no property values - updateSnapshotOptionsModelNew := new(vpcv1.UpdateSnapshotOptions) + // Construct a second instance of the CreateBackupPolicyOptions model with no property values + createBackupPolicyOptionsModelNew := new(vpcv1.CreateBackupPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModelNew) + result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -55164,10 +63601,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateSnapshot successfully`, func() { + It(`Invoke CreateBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55176,22 +63613,69 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -55203,25 +63687,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) - Operation response error`, func() { + Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) - Operation response error`, func() { version := "2024-06-23" - listSnapshotClonesPath := "/snapshots/testString/clones" + listBackupPolicyJobsPath := "/backup_policies/testString/jobs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotClonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"failed"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSnapshotClones with error: Operation response processing error`, func() { + It(`Invoke ListBackupPolicyJobs with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55230,19 +63722,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -55252,30 +63752,38 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions)`, func() { + Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions)`, func() { version := "2024-06-23" - listSnapshotClonesPath := "/snapshots/testString/clones" + listBackupPolicyJobsPath := "/backup_policies/testString/jobs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotClonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"failed"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListSnapshotClones successfully with retries`, func() { + It(`Invoke ListBackupPolicyJobs successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55285,21 +63793,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListSnapshotClonesWithContext(ctx, listSnapshotClonesOptionsModel) + _, _, operationErr := vpcService.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -55307,7 +63823,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListSnapshotClonesWithContext(ctx, listSnapshotClonesOptionsModel) + _, _, operationErr = vpcService.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -55321,18 +63837,26 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotClonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"failed"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListSnapshotClones successfully`, func() { + It(`Invoke ListBackupPolicyJobs successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55342,24 +63866,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListSnapshotClones(nil) + result, response, operationErr := vpcService.ListBackupPolicyJobs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSnapshotClones with error: Operation validation and request error`, func() { + It(`Invoke ListBackupPolicyJobs with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55368,22 +63900,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListSnapshotClonesOptions model with no property values - listSnapshotClonesOptionsModelNew := new(vpcv1.ListSnapshotClonesOptions) + // Construct a second instance of the ListBackupPolicyJobsOptions model with no property values + listBackupPolicyJobsOptionsModelNew := new(vpcv1.ListBackupPolicyJobsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModelNew) + result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -55401,7 +63941,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListSnapshotClones successfully`, func() { + It(`Invoke ListBackupPolicyJobs successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55410,13 +63950,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -55427,25 +63975,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions)`, func() { - version := "2024-06-23" - deleteSnapshotClonePath := "/snapshots/testString/clones/us-south-1" - Context(`Using mock server endpoint`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BackupPolicyJobCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.BackupPolicyJobCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.BackupPolicyJobCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotClonePath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke DeleteSnapshotClone successfully`, func() { + It(`Use BackupPolicyJobsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55454,23 +64036,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteSnapshotClone(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + listBackupPolicyJobsOptionsModel := &vpcv1.ListBackupPolicyJobsOptions{ + BackupPolicyID: core.StringPtr("testString"), + Status: core.StringPtr("failed"), + BackupPolicyPlanID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + SourceID: core.StringPtr("testString"), + TargetSnapshotsID: core.StringPtr("testString"), + TargetSnapshotsCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"), + } - // Construct an instance of the DeleteSnapshotCloneOptions model - deleteSnapshotCloneOptionsModel := new(vpcv1.DeleteSnapshotCloneOptions) - deleteSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - deleteSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + pager, err := vpcService.NewBackupPolicyJobsPager(listBackupPolicyJobsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + var allResults []vpcv1.BackupPolicyJob + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - It(`Invoke DeleteSnapshotClone with error: Operation validation and request error`, func() { + It(`Use BackupPolicyJobsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55479,40 +64069,38 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteSnapshotCloneOptions model - deleteSnapshotCloneOptionsModel := new(vpcv1.DeleteSnapshotCloneOptions) - deleteSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - deleteSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") + listBackupPolicyJobsOptionsModel := &vpcv1.ListBackupPolicyJobsOptions{ + BackupPolicyID: core.StringPtr("testString"), + Status: core.StringPtr("failed"), + BackupPolicyPlanID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + SourceID: core.StringPtr("testString"), + TargetSnapshotsID: core.StringPtr("testString"), + TargetSnapshotsCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"), + } + + pager, err := vpcService.NewBackupPolicyJobsPager(listBackupPolicyJobsOptionsModel) Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSnapshotCloneOptions model with no property values - deleteSnapshotCloneOptionsModelNew := new(vpcv1.DeleteSnapshotCloneOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) - Operation response error`, func() { + Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) - Operation response error`, func() { version := "2024-06-23" - getSnapshotClonePath := "/snapshots/testString/clones/us-south-1" + getBackupPolicyJobPath := "/backup_policies/testString/jobs/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotClonePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -55521,7 +64109,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSnapshotClone with error: Operation response processing error`, func() { + It(`Invoke GetBackupPolicyJob with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55530,20 +64118,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -55553,16 +64141,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions)`, func() { + Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions)`, func() { version := "2024-06-23" - getSnapshotClonePath := "/snapshots/testString/clones/us-south-1" + getBackupPolicyJobPath := "/backup_policies/testString/jobs/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotClonePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -55573,10 +64161,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke GetSnapshotClone successfully with retries`, func() { + It(`Invoke GetBackupPolicyJob successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55586,22 +64174,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetSnapshotCloneWithContext(ctx, getSnapshotCloneOptionsModel) + _, _, operationErr := vpcService.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -55609,7 +64197,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetSnapshotCloneWithContext(ctx, getSnapshotCloneOptionsModel) + _, _, operationErr = vpcService.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -55623,7 +64211,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotClonePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -55631,10 +64219,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke GetSnapshotClone successfully`, func() { + It(`Invoke GetBackupPolicyJob successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55644,25 +64232,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetSnapshotClone(nil) + result, response, operationErr := vpcService.GetBackupPolicyJob(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSnapshotClone with error: Operation validation and request error`, func() { + It(`Invoke GetBackupPolicyJob with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55671,23 +64259,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSnapshotCloneOptions model with no property values - getSnapshotCloneOptionsModelNew := new(vpcv1.GetSnapshotCloneOptions) + // Construct a second instance of the GetBackupPolicyJobOptions model with no property values + getBackupPolicyJobOptionsModelNew := new(vpcv1.GetBackupPolicyJobOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModelNew) + result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -55705,7 +64293,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSnapshotClone successfully`, func() { + It(`Invoke GetBackupPolicyJob successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55714,14 +64302,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -55733,25 +64321,26 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) - Operation response error`, func() { + Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) - Operation response error`, func() { version := "2024-06-23" - createSnapshotClonePath := "/snapshots/testString/clones/us-south-1" + listBackupPolicyPlansPath := "/backup_policies/testString/plans" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotClonePath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSnapshotClone with error: Operation response processing error`, func() { + It(`Invoke ListBackupPolicyPlans with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55760,20 +64349,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") + listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -55783,30 +64372,31 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions)`, func() { + Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions)`, func() { version := "2024-06-23" - createSnapshotClonePath := "/snapshots/testString/clones/us-south-1" + listBackupPolicyPlansPath := "/backup_policies/testString/plans" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotClonePath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}`) })) }) - It(`Invoke CreateSnapshotClone successfully with retries`, func() { + It(`Invoke ListBackupPolicyPlans successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55816,22 +64406,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") + listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateSnapshotCloneWithContext(ctx, createSnapshotCloneOptionsModel) + _, _, operationErr := vpcService.ListBackupPolicyPlansWithContext(ctx, listBackupPolicyPlansOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -55839,7 +64429,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateSnapshotCloneWithContext(ctx, createSnapshotCloneOptionsModel) + _, _, operationErr = vpcService.ListBackupPolicyPlansWithContext(ctx, listBackupPolicyPlansOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -55853,18 +64443,19 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotClonePath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}`) })) }) - It(`Invoke CreateSnapshotClone successfully`, func() { + It(`Invoke ListBackupPolicyPlans successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55874,25 +64465,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateSnapshotClone(nil) + result, response, operationErr := vpcService.ListBackupPolicyPlans(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") + listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSnapshotClone with error: Operation validation and request error`, func() { + It(`Invoke ListBackupPolicyPlans with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55901,23 +64492,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") + listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateSnapshotCloneOptions model with no property values - createSnapshotCloneOptionsModelNew := new(vpcv1.CreateSnapshotCloneOptions) + // Construct a second instance of the ListBackupPolicyPlansOptions model with no property values + listBackupPolicyPlansOptionsModelNew := new(vpcv1.ListBackupPolicyPlansOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModelNew) + result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -55935,7 +64526,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke CreateSnapshotClone successfully`, func() { + It(`Invoke ListBackupPolicyPlans successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55944,14 +64535,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("us-south-1") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") + listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -55963,28 +64554,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) - Operation response error`, func() { + Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) - Operation response error`, func() { version := "2024-06-23" - listShareProfilesPath := "/share/profiles" + createBackupPolicyPlanPath := "/backup_policies/testString/plans" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListShareProfiles with error: Operation response processing error`, func() { + It(`Invoke CreateBackupPolicyPlan with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55993,21 +64581,55 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -56017,33 +64639,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions)`, func() { + Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions)`, func() { version := "2024-06-23" - listShareProfilesPath := "/share/profiles" + createBackupPolicyPlanPath := "/backup_policies/testString/plans" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke ListShareProfiles successfully with retries`, func() { + It(`Invoke CreateBackupPolicyPlan successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56053,23 +64688,57 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListShareProfilesWithContext(ctx, listShareProfilesOptionsModel) + _, _, operationErr := vpcService.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -56077,7 +64746,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListShareProfilesWithContext(ctx, listShareProfilesOptionsModel) + _, _, operationErr = vpcService.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -56091,21 +64760,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke ListShareProfiles successfully`, func() { + It(`Invoke CreateBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56115,26 +64797,60 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListShareProfiles(nil) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListShareProfiles with error: Operation request error`, func() { + It(`Invoke CreateBackupPolicyPlan with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56143,20 +64859,61 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the CreateBackupPolicyPlanOptions model with no property values + createBackupPolicyPlanOptionsModelNew := new(vpcv1.CreateBackupPolicyPlanOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -56168,10 +64925,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListShareProfiles successfully`, func() { + It(`Invoke CreateBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56180,15 +64937,49 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -56199,129 +64990,28 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ShareProfileCollection) - nextObject := new(vpcv1.ShareProfileCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.ShareProfileCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.ShareProfileCollection) - nextObject := new(vpcv1.ShareProfileCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use ShareProfilesPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listShareProfilesOptionsModel := &vpcv1.ListShareProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewShareProfilesPager(listShareProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.ShareProfile - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use ShareProfilesPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listShareProfilesOptionsModel := &vpcv1.ListShareProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewShareProfilesPager(listShareProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`GetShareProfile(getShareProfileOptions *GetShareProfileOptions) - Operation response error`, func() { + Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) - Operation response error`, func() { version := "2024-06-23" - getShareProfilePath := "/share/profiles/dp2" + deleteBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShareProfile with error: Operation response processing error`, func() { + It(`Invoke DeleteBackupPolicyPlan with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56330,19 +65020,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("dp2") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -56352,18 +65044,20 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareProfile(getShareProfileOptions *GetShareProfileOptions)`, func() { + Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions)`, func() { version := "2024-06-23" - getShareProfilePath := "/share/profiles/dp2" + deleteBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -56371,11 +65065,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke GetShareProfile successfully with retries`, func() { + It(`Invoke DeleteBackupPolicyPlan successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56385,21 +65079,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("dp2") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetShareProfileWithContext(ctx, getShareProfileOptionsModel) + _, _, operationErr := vpcService.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -56407,7 +65103,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareProfileWithContext(ctx, getShareProfileOptionsModel) + _, _, operationErr = vpcService.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -56421,18 +65117,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke GetShareProfile successfully`, func() { + It(`Invoke DeleteBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56442,24 +65140,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShareProfile(nil) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("dp2") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShareProfile with error: Operation validation and request error`, func() { + It(`Invoke DeleteBackupPolicyPlan with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56468,22 +65168,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("dp2") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetShareProfileOptions model with no property values - getShareProfileOptionsModelNew := new(vpcv1.GetShareProfileOptions) + // Construct a second instance of the DeleteBackupPolicyPlanOptions model with no property values + deleteBackupPolicyPlanOptionsModelNew := new(vpcv1.DeleteBackupPolicyPlanOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModelNew) + result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -56498,10 +65200,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke GetShareProfile successfully`, func() { + It(`Invoke DeleteBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56510,13 +65212,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("dp2") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -56528,31 +65232,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShares(listSharesOptions *ListSharesOptions) - Operation response error`, func() { + Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) - Operation response error`, func() { version := "2024-06-23" - listSharesPath := "/shares" + getBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListShares with error: Operation response processing error`, func() { + It(`Invoke GetBackupPolicyPlan with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56561,24 +65259,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("my-name") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -56588,36 +65282,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShares(listSharesOptions *ListSharesOptions)`, func() { + Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions)`, func() { version := "2024-06-23" - listSharesPath := "/shares" + getBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke ListShares successfully with retries`, func() { + It(`Invoke GetBackupPolicyPlan successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56627,26 +65315,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("my-name") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListSharesWithContext(ctx, listSharesOptionsModel) + _, _, operationErr := vpcService.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -56654,7 +65338,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListSharesWithContext(ctx, listSharesOptionsModel) + _, _, operationErr = vpcService.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -56668,24 +65352,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "shares": [{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke ListShares successfully`, func() { + It(`Invoke GetBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56695,29 +65373,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListShares(nil) + result, response, operationErr := vpcService.GetBackupPolicyPlan(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("my-name") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListShares with error: Operation request error`, func() { + It(`Invoke GetBackupPolicyPlan with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56726,23 +65400,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("my-name") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the GetBackupPolicyPlanOptions model with no property values + getBackupPolicyPlanOptionsModelNew := new(vpcv1.GetBackupPolicyPlanOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -56757,7 +65434,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListShares successfully`, func() { + It(`Invoke GetBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56766,18 +65443,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("my-name") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -56788,135 +65461,28 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ShareCollection) - nextObject := new(vpcv1.ShareCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.ShareCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.ShareCollection) - nextObject := new(vpcv1.ShareCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r134-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_transit_encryption_modes":["none"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"origin_share_access_revoked","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"user_tags":["UserTags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"shares":[{"access_control_mode":"security_group","accessor_binding_role":"accessor","accessor_bindings":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r134-ce9dac18-dea0-4392-841c-142d3300674f","resource_type":"share_accessor_binding"}],"allowed_transit_encryption_modes":["none"],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_reasons":[{"code":"origin_share_access_revoked","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","origin_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"user_tags":["UserTags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use SharesPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listSharesOptionsModel := &vpcv1.ListSharesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - Sort: core.StringPtr("name"), - ReplicationRole: core.StringPtr("none"), - } - - pager, err := vpcService.NewSharesPager(listSharesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Share - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use SharesPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listSharesOptionsModel := &vpcv1.ListSharesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - Sort: core.StringPtr("name"), - ReplicationRole: core.StringPtr("none"), - } - - pager, err := vpcService.NewSharesPager(listSharesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateShare(createShareOptions *CreateShareOptions) - Operation response error`, func() { + Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) - Operation response error`, func() { version := "2024-06-23" - createSharePath := "/shares" + updateBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSharePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateShare with error: Operation response processing error`, func() { + It(`Invoke UpdateBackupPolicyPlan with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56925,107 +65491,63 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) // Construct an instance of the EncryptionKeyIdentityByCRN model encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) - sharePrototypeModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -57035,17 +65557,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateShare(createShareOptions *CreateShareOptions)`, func() { + Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions)`, func() { version := "2024-06-23" - createSharePath := "/shares" + updateBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSharePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -57063,6 +65585,8 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -57070,11 +65594,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke CreateShare successfully with retries`, func() { + It(`Invoke UpdateBackupPolicyPlan successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57084,109 +65608,65 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) // Construct an instance of the EncryptionKeyIdentityByCRN model encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) - sharePrototypeModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateShareWithContext(ctx, createShareOptionsModel) + _, _, operationErr := vpcService.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -57194,7 +65674,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateShareWithContext(ctx, createShareOptionsModel) + _, _, operationErr = vpcService.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -57208,8 +65688,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSharePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -57227,15 +65707,17 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke CreateShare successfully`, func() { + It(`Invoke UpdateBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57245,112 +65727,68 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateShare(nil) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) // Construct an instance of the EncryptionKeyIdentityByCRN model encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) - sharePrototypeModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateShare with error: Operation validation and request error`, func() { + It(`Invoke UpdateBackupPolicyPlan with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57359,110 +65797,66 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) // Construct an instance of the EncryptionKeyIdentityByCRN model encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) - sharePrototypeModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateShareOptions model with no property values - createShareOptionsModelNew := new(vpcv1.CreateShareOptions) + // Construct a second instance of the UpdateBackupPolicyPlanOptions model with no property values + updateBackupPolicyPlanOptionsModelNew := new(vpcv1.UpdateBackupPolicyPlanOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateShare(createShareOptionsModelNew) + result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -57477,10 +65871,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateShare successfully`, func() { + It(`Invoke UpdateBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57489,101 +65883,57 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) // Construct an instance of the EncryptionKeyIdentityByCRN model encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.AllowedTransitEncryptionModes = []string{"none"} - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) - sharePrototypeModel.Zone = zoneIdentityModel + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -57595,16 +65945,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShare(deleteShareOptions *DeleteShareOptions) - Operation response error`, func() { + Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) - Operation response error`, func() { version := "2024-06-23" - deleteSharePath := "/shares/testString" + deleteBackupPolicyPath := "/backup_policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.Header["If-Match"]).ToNot(BeNil()) Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) @@ -57615,7 +65965,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteShare with error: Operation response processing error`, func() { + It(`Invoke DeleteBackupPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57624,20 +65974,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModel) + result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -57647,16 +65997,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShare(deleteShareOptions *DeleteShareOptions)`, func() { + Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions)`, func() { version := "2024-06-23" - deleteSharePath := "/shares/testString" + deleteBackupPolicyPath := "/backup_policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.Header["If-Match"]).ToNot(BeNil()) @@ -57669,10 +66019,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke DeleteShare successfully with retries`, func() { + It(`Invoke DeleteBackupPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57682,22 +66032,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.DeleteShareWithContext(ctx, deleteShareOptionsModel) + _, _, operationErr := vpcService.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -57705,7 +66055,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteShareWithContext(ctx, deleteShareOptionsModel) + _, _, operationErr = vpcService.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -57719,7 +66069,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.Header["If-Match"]).ToNot(BeNil()) @@ -57729,10 +66079,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke DeleteShare successfully`, func() { + It(`Invoke DeleteBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57742,25 +66092,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteShare(nil) + result, response, operationErr := vpcService.DeleteBackupPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModel) + result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteShare with error: Operation validation and request error`, func() { + It(`Invoke DeleteBackupPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57769,23 +66119,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeleteShareOptions model with no property values - deleteShareOptionsModelNew := new(vpcv1.DeleteShareOptions) + // Construct a second instance of the DeleteBackupPolicyOptions model with no property values + deleteBackupPolicyOptionsModelNew := new(vpcv1.DeleteBackupPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModelNew) + result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -57803,7 +66153,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(202) })) }) - It(`Invoke DeleteShare successfully`, func() { + It(`Invoke DeleteBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57812,14 +66162,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -57831,16 +66181,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShare(getShareOptions *GetShareOptions) - Operation response error`, func() { + Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) - Operation response error`, func() { version := "2024-06-23" - getSharePath := "/shares/testString" + getBackupPolicyPath := "/backup_policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -57849,7 +66199,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShare with error: Operation response processing error`, func() { + It(`Invoke GetBackupPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57858,19 +66208,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetShare(getShareOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetShare(getShareOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -57880,16 +66230,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShare(getShareOptions *GetShareOptions)`, func() { + Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions)`, func() { version := "2024-06-23" - getSharePath := "/shares/testString" + getBackupPolicyPath := "/backup_policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -57900,10 +66250,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke GetShare successfully with retries`, func() { + It(`Invoke GetBackupPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57913,21 +66263,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetShareWithContext(ctx, getShareOptionsModel) + _, _, operationErr := vpcService.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShare(getShareOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -57935,7 +66285,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareWithContext(ctx, getShareOptionsModel) + _, _, operationErr = vpcService.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -57949,7 +66299,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -57957,10 +66307,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke GetShare successfully`, func() { + It(`Invoke GetBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57970,24 +66320,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShare(nil) + result, response, operationErr := vpcService.GetBackupPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShare(getShareOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShare with error: Operation validation and request error`, func() { + It(`Invoke GetBackupPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57996,22 +66346,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetShare(getShareOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetShareOptions model with no property values - getShareOptionsModelNew := new(vpcv1.GetShareOptions) + // Construct a second instance of the GetBackupPolicyOptions model with no property values + getBackupPolicyOptionsModelNew := new(vpcv1.GetBackupPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShare(getShareOptionsModelNew) + result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -58029,7 +66379,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetShare successfully`, func() { + It(`Invoke GetBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58038,13 +66388,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShare(getShareOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -58056,16 +66406,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateShare(updateShareOptions *UpdateShareOptions) - Operation response error`, func() { + Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) - Operation response error`, func() { version := "2024-06-23" - updateSharePath := "/shares/testString" + updateBackupPolicyPath := "/backup_policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["If-Match"]).ToNot(BeNil()) Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) @@ -58076,7 +66426,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateShare with error: Operation response processing error`, func() { + It(`Invoke UpdateBackupPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58085,38 +66435,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -58126,16 +66467,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateShare(updateShareOptions *UpdateShareOptions)`, func() { + Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions)`, func() { version := "2024-06-23" - updateSharePath := "/shares/testString" + updateBackupPolicyPath := "/backup_policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -58164,10 +66505,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke UpdateShare successfully with retries`, func() { + It(`Invoke UpdateBackupPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58177,40 +66518,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateShareWithContext(ctx, updateShareOptionsModel) + _, _, operationErr := vpcService.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -58218,7 +66550,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateShareWithContext(ctx, updateShareOptionsModel) + _, _, operationErr = vpcService.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -58232,7 +66564,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -58258,10 +66590,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "accessor_binding_role": "accessor", "accessor_bindings": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "resource_type": "share_accessor_binding"}], "allowed_transit_encryption_modes": ["none"], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_reasons": [{"code": "origin_share_access_revoked", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "origin_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "ebc2b430240943458b9e91e1432cfcce", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke UpdateShare successfully`, func() { + It(`Invoke UpdateBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58271,43 +66603,34 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateShare(nil) + result, response, operationErr := vpcService.UpdateBackupPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateShare with error: Operation validation and request error`, func() { + It(`Invoke UpdateBackupPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58316,41 +66639,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateShareOptions model with no property values - updateShareOptionsModelNew := new(vpcv1.UpdateShareOptions) + // Construct a second instance of the UpdateBackupPolicyOptions model with no property values + updateBackupPolicyOptionsModelNew := new(vpcv1.UpdateBackupPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModelNew) + result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -58368,7 +66682,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateShare successfully`, func() { + It(`Invoke UpdateBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58377,32 +66691,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.AllowedTransitEncryptionModes = []string{"none"} - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -58414,27 +66719,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) - Operation response error`, func() { + Describe(`ListRegions(listRegionsOptions *ListRegionsOptions) - Operation response error`, func() { version := "2024-06-23" - listShareAccessorBindingsPath := "/shares/testString/accessor_bindings" + listRegionsPath := "/regions" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareAccessorBindingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listRegionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListShareAccessorBindings with error: Operation response processing error`, func() { + It(`Invoke ListRegions with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58443,21 +66746,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareAccessorBindingsOptions model - listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) - listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) + result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -58467,32 +66767,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions)`, func() { + Describe(`ListRegions(listRegionsOptions *ListRegionsOptions)`, func() { version := "2024-06-23" - listShareAccessorBindingsPath := "/shares/testString/accessor_bindings" + listRegionsPath := "/regions" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareAccessorBindingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listRegionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"regions": [{"endpoint": "https://eu-gb.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) })) }) - It(`Invoke ListShareAccessorBindings successfully with retries`, func() { + It(`Invoke ListRegions successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58502,23 +66800,20 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListShareAccessorBindingsOptions model - listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) - listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListShareAccessorBindingsWithContext(ctx, listShareAccessorBindingsOptionsModel) + _, _, operationErr := vpcService.ListRegionsWithContext(ctx, listRegionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -58526,7 +66821,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListShareAccessorBindingsWithContext(ctx, listShareAccessorBindingsOptionsModel) + _, _, operationErr = vpcService.ListRegionsWithContext(ctx, listRegionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -58540,20 +66835,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareAccessorBindingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listRegionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accessor_bindings": [{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"regions": [{"endpoint": "https://eu-gb.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) })) }) - It(`Invoke ListShareAccessorBindings successfully`, func() { + It(`Invoke ListRegions successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58563,26 +66856,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListShareAccessorBindings(nil) + result, response, operationErr := vpcService.ListRegions(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListShareAccessorBindingsOptions model - listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) - listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) + result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListShareAccessorBindings with error: Operation validation and request error`, func() { + It(`Invoke ListRegions with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58591,27 +66881,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareAccessorBindingsOptions model - listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) - listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListShareAccessorBindingsOptions model with no property values - listShareAccessorBindingsOptionsModelNew := new(vpcv1.ListShareAccessorBindingsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -58622,160 +66902,11 @@ var _ = Describe(`VpcV1`, func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke ListShareAccessorBindings successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListShareAccessorBindingsOptions model - listShareAccessorBindingsOptionsModel := new(vpcv1.ListShareAccessorBindingsOptions) - listShareAccessorBindingsOptionsModel.ID = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Start = core.StringPtr("testString") - listShareAccessorBindingsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareAccessorBindingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListShareAccessorBindings(listShareAccessorBindingsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ShareAccessorBindingCollection) - nextObject := new(vpcv1.ShareAccessorBindingCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.ShareAccessorBindingCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.ShareAccessorBindingCollection) - nextObject := new(vpcv1.ShareAccessorBindingCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareAccessorBindingsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r134-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"accessor_bindings":[{"accessor":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f","id":"r134-ce9dac18-dea0-4392-841c-142d3300674f","lifecycle_state":"stable","resource_type":"share_accessor_binding"}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use ShareAccessorBindingsPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listShareAccessorBindingsOptionsModel := &vpcv1.ListShareAccessorBindingsOptions{ - ID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewShareAccessorBindingsPager(listShareAccessorBindingsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.ShareAccessorBinding - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use ShareAccessorBindingsPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listShareAccessorBindingsOptionsModel := &vpcv1.ListShareAccessorBindingsOptions{ - ID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewShareAccessorBindingsPager(listShareAccessorBindingsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) - }) - Describe(`DeleteShareAccessorBinding(deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions)`, func() { - version := "2024-06-23" - deleteShareAccessorBindingPath := "/shares/testString/accessor_bindings/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteShareAccessorBindingPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + // Set success status code with no respoonse body + res.WriteHeader(200) })) }) - It(`Invoke DeleteShareAccessorBinding successfully`, func() { + It(`Invoke ListRegions successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58784,65 +66915,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteShareAccessorBinding(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteShareAccessorBindingOptions model - deleteShareAccessorBindingOptionsModel := new(vpcv1.DeleteShareAccessorBindingOptions) - deleteShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") - deleteShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") - deleteShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteShareAccessorBinding(deleteShareAccessorBindingOptionsModel) + // Invoke operation + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteShareAccessorBinding with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareAccessorBindingOptions model - deleteShareAccessorBindingOptionsModel := new(vpcv1.DeleteShareAccessorBindingOptions) - deleteShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") - deleteShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") - deleteShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteShareAccessorBinding(deleteShareAccessorBindingOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteShareAccessorBindingOptions model with no property values - deleteShareAccessorBindingOptionsModelNew := new(vpcv1.DeleteShareAccessorBindingOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteShareAccessorBinding(deleteShareAccessorBindingOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions) - Operation response error`, func() { + Describe(`GetRegion(getRegionOptions *GetRegionOptions) - Operation response error`, func() { version := "2024-06-23" - getShareAccessorBindingPath := "/shares/testString/accessor_bindings/testString" + getRegionPath := "/regions/us-south" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareAccessorBindingPath)) + Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -58851,7 +66950,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShareAccessorBinding with error: Operation response processing error`, func() { + It(`Invoke GetRegion with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58860,20 +66959,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareAccessorBindingOptions model - getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) - getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("us-south") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) + result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -58883,16 +66981,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions)`, func() { + Describe(`GetRegion(getRegionOptions *GetRegionOptions)`, func() { version := "2024-06-23" - getShareAccessorBindingPath := "/shares/testString/accessor_bindings/testString" + getRegionPath := "/regions/us-south" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareAccessorBindingPath)) + Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -58903,10 +67001,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}`) + fmt.Fprintf(res, "%s", `{"endpoint": "https://eu-gb.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) })) }) - It(`Invoke GetShareAccessorBinding successfully with retries`, func() { + It(`Invoke GetRegion successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58916,22 +67014,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareAccessorBindingOptions model - getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) - getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("us-south") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetShareAccessorBindingWithContext(ctx, getShareAccessorBindingOptionsModel) + _, _, operationErr := vpcService.GetRegionWithContext(ctx, getRegionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -58939,7 +67036,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareAccessorBindingWithContext(ctx, getShareAccessorBindingOptionsModel) + _, _, operationErr = vpcService.GetRegionWithContext(ctx, getRegionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -58953,7 +67050,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareAccessorBindingPath)) + Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -58961,10 +67058,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accessor": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/accessor_bindings/r134-ae9bdc18-aed0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "share_accessor_binding"}`) + fmt.Fprintf(res, "%s", `{"endpoint": "https://eu-gb.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) })) }) - It(`Invoke GetShareAccessorBinding successfully`, func() { + It(`Invoke GetRegion successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58974,25 +67071,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShareAccessorBinding(nil) + result, response, operationErr := vpcService.GetRegion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareAccessorBindingOptions model - getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) - getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("us-south") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) + result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShareAccessorBinding with error: Operation validation and request error`, func() { + It(`Invoke GetRegion with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59001,23 +67097,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareAccessorBindingOptions model - getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) - getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("us-south") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetShareAccessorBindingOptions model with no property values - getShareAccessorBindingOptionsModelNew := new(vpcv1.GetShareAccessorBindingOptions) + // Construct a second instance of the GetRegionOptions model with no property values + getRegionOptionsModelNew := new(vpcv1.GetRegionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModelNew) + result, response, operationErr = vpcService.GetRegion(getRegionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -59035,7 +67130,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetShareAccessorBinding successfully`, func() { + It(`Invoke GetRegion successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59044,14 +67139,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareAccessorBindingOptions model - getShareAccessorBindingOptionsModel := new(vpcv1.GetShareAccessorBindingOptions) - getShareAccessorBindingOptionsModel.ShareID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.ID = core.StringPtr("testString") - getShareAccessorBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("us-south") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShareAccessorBinding(getShareAccessorBindingOptionsModel) + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -59063,121 +67157,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`FailoverShare(failoverShareOptions *FailoverShareOptions)`, func() { - version := "2024-06-23" - failoverSharePath := "/shares/testString/failover" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(failoverSharePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke FailoverShare successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.FailoverShare(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the FailoverShareOptions model - failoverShareOptionsModel := new(vpcv1.FailoverShareOptions) - failoverShareOptionsModel.ShareID = core.StringPtr("testString") - failoverShareOptionsModel.FallbackPolicy = core.StringPtr("fail") - failoverShareOptionsModel.Timeout = core.Int64Ptr(int64(600)) - failoverShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.FailoverShare(failoverShareOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke FailoverShare with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the FailoverShareOptions model - failoverShareOptionsModel := new(vpcv1.FailoverShareOptions) - failoverShareOptionsModel.ShareID = core.StringPtr("testString") - failoverShareOptionsModel.FallbackPolicy = core.StringPtr("fail") - failoverShareOptionsModel.Timeout = core.Int64Ptr(int64(600)) - failoverShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.FailoverShare(failoverShareOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the FailoverShareOptions model with no property values - failoverShareOptionsModelNew := new(vpcv1.FailoverShareOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.FailoverShare(failoverShareOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) - Operation response error`, func() { + Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) - Operation response error`, func() { version := "2024-06-23" - listShareMountTargetsPath := "/shares/testString/mount_targets" + listRegionZonesPath := "/regions/us-south/zones" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listRegionZonesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListShareMountTargets with error: Operation response processing error`, func() { + It(`Invoke ListRegionZones with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59186,22 +67184,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -59211,33 +67206,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions)`, func() { + Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions)`, func() { version := "2024-06-23" - listShareMountTargetsPath := "/shares/testString/mount_targets" + listRegionZonesPath := "/regions/us-south/zones" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listRegionZonesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?limit=20"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"zones": [{"data_center": "DAL12", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available", "universal_name": "us-south-dal10-a"}]}`) })) }) - It(`Invoke ListShareMountTargets successfully with retries`, func() { + It(`Invoke ListRegionZones successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59247,24 +67239,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListShareMountTargetsWithContext(ctx, listShareMountTargetsOptionsModel) + _, _, operationErr := vpcService.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -59272,7 +67261,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListShareMountTargetsWithContext(ctx, listShareMountTargetsOptionsModel) + _, _, operationErr = vpcService.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -59286,21 +67275,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listRegionZonesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?limit=20"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"zones": [{"data_center": "DAL12", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available", "universal_name": "us-south-dal10-a"}]}`) })) }) - It(`Invoke ListShareMountTargets successfully`, func() { + It(`Invoke ListRegionZones successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59310,27 +67296,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListShareMountTargets(nil) + result, response, operationErr := vpcService.ListRegionZones(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListShareMountTargets with error: Operation validation and request error`, func() { + It(`Invoke ListRegionZones with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59339,25 +67322,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListShareMountTargetsOptions model with no property values - listShareMountTargetsOptionsModelNew := new(vpcv1.ListShareMountTargetsOptions) + // Construct a second instance of the ListRegionZonesOptions model with no property values + listRegionZonesOptionsModelNew := new(vpcv1.ListRegionZonesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModelNew) + result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -59375,7 +67355,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListShareMountTargets successfully`, func() { + It(`Invoke ListRegionZones successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59384,16 +67364,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("my-name") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -59404,59 +67381,167 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ShareMountTargetCollection) - nextObject := new(vpcv1.ShareMountTargetCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject + }) + Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) - Operation response error`, func() { + version := "2024-06-23" + getRegionZonePath := "/regions/us-south/zones/us-south-1" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.ShareMountTargetCollection) + It(`Invoke GetRegionZone with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") + getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") + getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.ShareMountTargetCollection) - nextObject := new(vpcv1.ShareMountTargetCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions)`, func() { + version := "2024-06-23" + getRegionZonePath := "/regions/us-south/zones/us-south-1" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"data_center": "DAL12", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available", "universal_name": "us-south-dal10-a"}`) + })) + }) + It(`Invoke GetRegionZone successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") + getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") + getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetRegionZoneWithContext(ctx, getRegionZoneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetRegionZoneWithContext(ctx, getRegionZoneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() }) }) - Context(`Using mock server endpoint - paginated response`, func() { + Context(`Using mock server endpoint`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) - Expect(req.Method).To(Equal("GET")) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"data_center": "DAL12", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available", "universal_name": "us-south-dal10-a"}`) + })) + }) + It(`Invoke GetRegionZone successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetRegionZone(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") + getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") + getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"share_mount_target","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) - } else { - res.WriteHeader(400) - } - })) }) - It(`Use ShareMountTargetsPager.GetNext successfully`, func() { + It(`Invoke GetRegionZone with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59465,26 +67550,41 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listShareMountTargetsOptionsModel := &vpcv1.ListShareMountTargetsOptions{ - ShareID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewShareMountTargetsPager(listShareMountTargetsOptionsModel) + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") + getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") + getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetRegionZoneOptions model with no property values + getRegionZoneOptionsModelNew := new(vpcv1.GetRegionZoneOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - var allResults []vpcv1.ShareMountTarget - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Set success status code with no respoonse body + res.WriteHeader(200) + })) }) - It(`Use ShareMountTargetsPager.GetAll successfully`, func() { + It(`Invoke GetRegionZone successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59493,42 +67593,47 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listShareMountTargetsOptionsModel := &vpcv1.ListShareMountTargetsOptions{ - ShareID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - Limit: core.Int64Ptr(int64(10)), - } + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") + getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") + getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - pager, err := vpcService.NewShareMountTargetsPager(listShareMountTargetsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Invoke operation + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) - Operation response error`, func() { + Describe(`ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) - Operation response error`, func() { version := "2024-06-23" - createShareMountTargetPath := "/shares/testString/mount_targets" + listVirtualNetworkInterfacesPath := "/virtual_network_interfaces" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createShareMountTargetPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateShareMountTarget with error: Operation response processing error`, func() { + It(`Invoke ListVirtualNetworkInterfaces with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59537,63 +67642,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -59603,46 +67666,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions)`, func() { + Describe(`ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions)`, func() { version := "2024-06-23" - createShareMountTargetPath := "/shares/testString/mount_targets" + listVirtualNetworkInterfacesPath := "/virtual_network_interfaces" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createShareMountTargetPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke CreateShareMountTarget successfully with retries`, func() { + It(`Invoke ListVirtualNetworkInterfaces successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59652,65 +67702,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateShareMountTargetWithContext(ctx, createShareMountTargetOptionsModel) + _, _, operationErr := vpcService.ListVirtualNetworkInterfacesWithContext(ctx, listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -59718,7 +67726,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateShareMountTargetWithContext(ctx, createShareMountTargetOptionsModel) + _, _, operationErr = vpcService.ListVirtualNetworkInterfacesWithContext(ctx, listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -59732,34 +67740,21 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createShareMountTargetPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke CreateShareMountTarget successfully`, func() { + It(`Invoke ListVirtualNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59769,68 +67764,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateShareMountTarget(nil) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateShareMountTarget with error: Operation validation and request error`, func() { + It(`Invoke ListVirtualNetworkInterfaces with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59839,69 +67792,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateShareMountTargetOptions model with no property values - createShareMountTargetOptionsModelNew := new(vpcv1.CreateShareMountTargetOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -59913,10 +67817,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateShareMountTarget successfully`, func() { + It(`Invoke ListVirtualNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59925,87 +67829,148 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Invoke operation + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) - shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ProtocolStateFilteringMode = core.StringPtr("auto") - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","ips":[{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","id":"0717-54eb57ee-86f2-4796-90bb-d7874e0831ef","ips":[{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VirtualNetworkInterfacesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + listVirtualNetworkInterfacesOptionsModel := &vpcv1.ListVirtualNetworkInterfacesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } - // Invoke operation - result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + pager, err := vpcService.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + var allResults []vpcv1.VirtualNetworkInterface + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - AfterEach(func() { - testServer.Close() + It(`Use VirtualNetworkInterfacesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listVirtualNetworkInterfacesOptionsModel := &vpcv1.ListVirtualNetworkInterfacesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) - Operation response error`, func() { + Describe(`CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - deleteShareMountTargetPath := "/shares/testString/mount_targets/testString" + createVirtualNetworkInterfacePath := "/virtual_network_interfaces" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteShareMountTarget with error: Operation response processing error`, func() { + It(`Invoke CreateVirtualNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60014,20 +67979,48 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) + virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) + virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr = vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -60037,17 +68030,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions)`, func() { + Describe(`CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions)`, func() { version := "2024-06-23" - deleteShareMountTargetPath := "/shares/testString/mount_targets/testString" + createVirtualNetworkInterfacePath := "/virtual_network_interfaces" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -60056,11 +68065,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke DeleteShareMountTarget successfully with retries`, func() { + It(`Invoke CreateVirtualNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60070,22 +68079,50 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) + virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) + virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.DeleteShareMountTargetWithContext(ctx, deleteShareMountTargetOptionsModel) + _, _, operationErr := vpcService.CreateVirtualNetworkInterfaceWithContext(ctx, createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -60093,7 +68130,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteShareMountTargetWithContext(ctx, deleteShareMountTargetOptionsModel) + _, _, operationErr = vpcService.CreateVirtualNetworkInterfaceWithContext(ctx, createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -60107,18 +68144,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke DeleteShareMountTarget successfully`, func() { + It(`Invoke CreateVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60128,25 +68181,53 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteShareMountTarget(nil) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) + virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) + virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr = vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteShareMountTarget with error: Operation validation and request error`, func() { + It(`Invoke CreateVirtualNetworkInterface with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60155,26 +68236,47 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) + virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) + virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeleteShareMountTargetOptions model with no property values - deleteShareMountTargetOptionsModelNew := new(vpcv1.DeleteShareMountTargetOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -60186,10 +68288,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(201) })) }) - It(`Invoke DeleteShareMountTarget successfully`, func() { + It(`Invoke CreateVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60198,14 +68300,42 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) + virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) + virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -60217,25 +68347,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) - Operation response error`, func() { + Describe(`DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) - Operation response error`, func() { version := "2024-06-23" - getShareMountTargetPath := "/shares/testString/mount_targets/testString" + deleteVirtualNetworkInterfacesPath := "/virtual_network_interfaces/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareMountTargetPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteVirtualNetworkInterfacesPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShareMountTarget with error: Operation response processing error`, func() { + It(`Invoke DeleteVirtualNetworkInterfaces with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60244,20 +68374,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model + deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) + deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") + deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr = vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -60267,17 +68396,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions)`, func() { + Describe(`DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions)`, func() { version := "2024-06-23" - getShareMountTargetPath := "/shares/testString/mount_targets/testString" + deleteVirtualNetworkInterfacesPath := "/virtual_network_interfaces/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareMountTargetPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteVirtualNetworkInterfacesPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -60286,11 +68415,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetShareMountTarget successfully with retries`, func() { + It(`Invoke DeleteVirtualNetworkInterfaces successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60300,22 +68429,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model + deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) + deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") + deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetShareMountTargetWithContext(ctx, getShareMountTargetOptionsModel) + _, _, operationErr := vpcService.DeleteVirtualNetworkInterfacesWithContext(ctx, deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -60323,7 +68451,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareMountTargetWithContext(ctx, getShareMountTargetOptionsModel) + _, _, operationErr = vpcService.DeleteVirtualNetworkInterfacesWithContext(ctx, deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -60337,18 +68465,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareMountTargetPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteVirtualNetworkInterfacesPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetShareMountTarget successfully`, func() { + It(`Invoke DeleteVirtualNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60358,25 +68486,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShareMountTarget(nil) + result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model + deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) + deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") + deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr = vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShareMountTarget with error: Operation validation and request error`, func() { + It(`Invoke DeleteVirtualNetworkInterfaces with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60385,23 +68512,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model + deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) + deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") + deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetShareMountTargetOptions model with no property values - getShareMountTargetOptionsModelNew := new(vpcv1.GetShareMountTargetOptions) + // Construct a second instance of the DeleteVirtualNetworkInterfacesOptions model with no property values + deleteVirtualNetworkInterfacesOptionsModelNew := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModelNew) + result, response, operationErr = vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -60416,10 +68542,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke GetShareMountTarget successfully`, func() { + It(`Invoke DeleteVirtualNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60428,14 +68554,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model + deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) + deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") + deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -60447,17 +68572,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) - Operation response error`, func() { + Describe(`GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - updateShareMountTargetPath := "/shares/testString/mount_targets/testString" + getVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -60465,7 +68590,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateShareMountTarget with error: Operation response processing error`, func() { + It(`Invoke GetVirtualNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60474,27 +68599,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -60504,33 +68621,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions)`, func() { + Describe(`GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions)`, func() { version := "2024-06-23" - updateShareMountTargetPath := "/shares/testString/mount_targets/testString" + getVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -60540,42 +68641,34 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateShareMountTarget successfully with retries`, func() { + It(`Invoke GetVirtualNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, Version: core.StringPtr(version), }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateShareMountTargetWithContext(ctx, updateShareMountTargetOptionsModel) + _, _, operationErr := vpcService.GetVirtualNetworkInterfaceWithContext(ctx, getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -60583,7 +68676,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateShareMountTargetWithContext(ctx, updateShareMountTargetOptionsModel) + _, _, operationErr = vpcService.GetVirtualNetworkInterfaceWithContext(ctx, getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -60597,34 +68690,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "share_mount_target", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateShareMountTarget successfully`, func() { + It(`Invoke GetVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60634,32 +68711,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateShareMountTarget(nil) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateShareMountTarget with error: Operation validation and request error`, func() { + It(`Invoke GetVirtualNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60668,30 +68737,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateShareMountTargetOptions model with no property values - updateShareMountTargetOptionsModelNew := new(vpcv1.UpdateShareMountTargetOptions) + // Construct a second instance of the GetVirtualNetworkInterfaceOptions model with no property values + getVirtualNetworkInterfaceOptionsModelNew := new(vpcv1.GetVirtualNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModelNew) + result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -60709,7 +68770,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateShareMountTarget successfully`, func() { + It(`Invoke GetVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60718,21 +68779,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -60744,90 +68797,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions)`, func() { - version := "2024-06-23" - deleteShareSourcePath := "/shares/testString/source" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteShareSourcePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteShareSource successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteShareSource(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteShareSourceOptions model - deleteShareSourceOptionsModel := new(vpcv1.DeleteShareSourceOptions) - deleteShareSourceOptionsModel.ShareID = core.StringPtr("testString") - deleteShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteShareSource(deleteShareSourceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteShareSource with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the DeleteShareSourceOptions model - deleteShareSourceOptionsModel := new(vpcv1.DeleteShareSourceOptions) - deleteShareSourceOptionsModel.ShareID = core.StringPtr("testString") - deleteShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteShareSource(deleteShareSourceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteShareSourceOptions model with no property values - deleteShareSourceOptionsModelNew := new(vpcv1.DeleteShareSourceOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteShareSource(deleteShareSourceOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetShareSource(getShareSourceOptions *GetShareSourceOptions) - Operation response error`, func() { + Describe(`UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - getShareSourcePath := "/shares/testString/source" + updateVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -60835,7 +68815,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShareSource with error: Operation response processing error`, func() { + It(`Invoke UpdateVirtualNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60844,19 +68824,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -60866,17 +68857,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareSource(getShareSourceOptions *GetShareSourceOptions)`, func() { + Describe(`UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions)`, func() { version := "2024-06-23" - getShareSourcePath := "/shares/testString/source" + updateVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -60886,10 +68893,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetShareSource successfully with retries`, func() { + It(`Invoke UpdateVirtualNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60899,21 +68906,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetShareSourceWithContext(ctx, getShareSourceOptionsModel) + _, _, operationErr := vpcService.UpdateVirtualNetworkInterfaceWithContext(ctx, updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -60921,7 +68939,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareSourceWithContext(ctx, getShareSourceOptionsModel) + _, _, operationErr = vpcService.UpdateVirtualNetworkInterfaceWithContext(ctx, updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -60935,18 +68953,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "id": "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetShareSource successfully`, func() { + It(`Invoke UpdateVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60956,24 +68990,35 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShareSource(nil) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShareSource with error: Operation validation and request error`, func() { + It(`Invoke UpdateVirtualNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60982,22 +69027,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetShareSourceOptions model with no property values - getShareSourceOptionsModelNew := new(vpcv1.GetShareSourceOptions) + // Construct a second instance of the UpdateVirtualNetworkInterfaceOptions model with no property values + updateVirtualNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModelNew) + result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -61015,7 +69071,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetShareSource successfully`, func() { + It(`Invoke UpdateVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61024,13 +69080,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -61042,30 +69109,28 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) - Operation response error`, func() { + Describe(`ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { version := "2024-06-23" - listBackupPoliciesPath := "/backup_policies" + listNetworkInterfaceFloatingIpsPath := "/virtual_network_interfaces/testString/floating_ips" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBackupPolicies with error: Operation response processing error`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61074,23 +69139,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -61100,35 +69164,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions)`, func() { + Describe(`ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions)`, func() { version := "2024-06-23" - listBackupPoliciesPath := "/backup_policies" + listNetworkInterfaceFloatingIpsPath := "/virtual_network_interfaces/testString/floating_ips" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListBackupPolicies successfully with retries`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61138,25 +69200,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) + _, _, operationErr := vpcService.ListNetworkInterfaceFloatingIpsWithContext(ctx, listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -61164,7 +69225,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) + _, _, operationErr = vpcService.ListNetworkInterfaceFloatingIpsWithContext(ctx, listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -61178,23 +69239,21 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke ListBackupPolicies successfully`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61204,28 +69263,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBackupPolicies(nil) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBackupPolicies with error: Operation request error`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61234,22 +69292,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ListNetworkInterfaceFloatingIpsOptions model with no property values + listNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -61264,7 +69328,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBackupPolicies successfully`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61273,17 +69337,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("my-name") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -61296,8 +69359,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BackupPolicyCollection) - nextObject := new(vpcv1.BackupPolicyCollectionNext) + responseObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -61306,15 +69369,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.BackupPolicyCollection) + responseObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContext) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.BackupPolicyCollection) - nextObject := new(vpcv1.BackupPolicyCollectionNext) + responseObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -61330,7 +69393,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -61338,15 +69401,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r134-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","match_user_tags":["MatchUserTags"],"name":"my-backup-policy","plans":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"backup_policy","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"fee82deba12e4c0fb69c3b09d1f12345","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r134-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","match_user_tags":["MatchUserTags"],"name":"my-backup-policy","plans":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"backup_policy","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"fee82deba12e4c0fb69c3b09d1f12345","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use BackupPoliciesPager.GetNext successfully`, func() { + It(`Use NetworkInterfaceFloatingIpsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61355,18 +69418,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listBackupPoliciesOptionsModel := &vpcv1.ListBackupPoliciesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - Tag: core.StringPtr("testString"), + listNetworkInterfaceFloatingIpsOptionsModel := &vpcv1.ListNetworkInterfaceFloatingIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), } - pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) + pager, err := vpcService.NewNetworkInterfaceFloatingIpsPager(listNetworkInterfaceFloatingIpsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.BackupPolicyIntf + var allResults []vpcv1.FloatingIPReference for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -61375,7 +69437,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use BackupPoliciesPager.GetAll successfully`, func() { + It(`Use NetworkInterfaceFloatingIpsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61384,14 +69446,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listBackupPoliciesOptionsModel := &vpcv1.ListBackupPoliciesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("my-name"), - Tag: core.StringPtr("testString"), + listNetworkInterfaceFloatingIpsOptionsModel := &vpcv1.ListNetworkInterfaceFloatingIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), } - pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) + pager, err := vpcService.NewNetworkInterfaceFloatingIpsPager(listNetworkInterfaceFloatingIpsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -61402,25 +69463,24 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) - Operation response error`, func() { + Describe(`RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions)`, func() { version := "2024-06-23" - createBackupPolicyPath := "/backup_policies" - Context(`Using mock server endpoint with invalid JSON response`, func() { + removeNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(removeNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke CreateBackupPolicy with error: Operation response processing error`, func() { + It(`Invoke RemoveNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61429,75 +69489,96 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.RemoveNetworkInterfaceFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + // Construct an instance of the RemoveNetworkInterfaceFloatingIPOptions model + removeNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) + removeNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + removeNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") + // Construct an instance of the RemoveNetworkInterfaceFloatingIPOptions model + removeNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) + removeNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + removeNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveNetworkInterfaceFloatingIPOptions model with no property values + removeNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + version := "2024-06-23" + getNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -61507,33 +69588,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions)`, func() { + Describe(`GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions)`, func() { version := "2024-06-23" - createBackupPolicyPath := "/backup_policies" + getNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -61542,11 +69607,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}`) })) }) - It(`Invoke CreateBackupPolicy successfully with retries`, func() { + It(`Invoke GetNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61556,77 +69621,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") - - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") - - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) + _, _, operationErr := vpcService.GetNetworkInterfaceFloatingIPWithContext(ctx, getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -61634,7 +69644,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) + _, _, operationErr = vpcService.GetNetworkInterfaceFloatingIPWithContext(ctx, getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -61648,34 +69658,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}`) })) }) - It(`Invoke CreateBackupPolicy successfully`, func() { + It(`Invoke GetNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61685,80 +69679,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBackupPolicy(nil) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") - - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") - - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBackupPolicy with error: Operation validation and request error`, func() { + It(`Invoke GetNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61767,167 +69706,57 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") - - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") - - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateBackupPolicyOptions model with no property values - createBackupPolicyOptionsModelNew := new(vpcv1.CreateBackupPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(201) - })) - }) - It(`Invoke CreateBackupPolicy successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce") + // Construct a second instance of the GetNetworkInterfaceFloatingIPOptions model with no property values + getNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetNetworkInterfaceFloatingIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -61939,33 +69768,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) - Operation response error`, func() { + Describe(`AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { version := "2024-06-23" - listBackupPolicyJobsPath := "/backup_policies/testString/jobs" + addNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).To(Equal([]string{"failed"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBackupPolicyJobs with error: Operation response processing error`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -61974,27 +69795,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -62004,38 +69818,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions)`, func() { + Describe(`AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions)`, func() { version := "2024-06-23" - listBackupPolicyJobsPath := "/backup_policies/testString/jobs" + addNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).To(Equal([]string{"failed"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobs?limit=20"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobss?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}`) })) }) - It(`Invoke ListBackupPolicyJobs successfully with retries`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62045,29 +69851,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) + _, _, operationErr := vpcService.AddNetworkInterfaceFloatingIPWithContext(ctx, addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -62075,7 +69874,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) + _, _, operationErr = vpcService.AddNetworkInterfaceFloatingIPWithContext(ctx, addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -62089,26 +69888,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).To(Equal([]string{"failed"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobs?limit=20"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobss?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}`) })) }) - It(`Invoke ListBackupPolicyJobs successfully`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62118,32 +69909,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBackupPolicyJobs(nil) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBackupPolicyJobs with error: Operation validation and request error`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62152,30 +69936,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListBackupPolicyJobsOptions model with no property values - listBackupPolicyJobsOptionsModelNew := new(vpcv1.ListBackupPolicyJobsOptions) + // Construct a second instance of the AddNetworkInterfaceFloatingIPOptions model with no property values + addNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModelNew) + result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -62193,7 +69970,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBackupPolicyJobs successfully`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62202,21 +69979,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -62227,141 +69997,29 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BackupPolicyJobCollection) - nextObject := new(vpcv1.BackupPolicyJobCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.BackupPolicyJobCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.BackupPolicyJobCollection) - nextObject := new(vpcv1.BackupPolicyJobCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"account":{"id":"bb1b52262f7441a586f49068482f1e60","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use BackupPolicyJobsPager.GetNext successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listBackupPolicyJobsOptionsModel := &vpcv1.ListBackupPolicyJobsOptions{ - BackupPolicyID: core.StringPtr("testString"), - Status: core.StringPtr("failed"), - BackupPolicyPlanID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - SourceID: core.StringPtr("testString"), - TargetSnapshotsID: core.StringPtr("testString"), - TargetSnapshotsCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"), - } - - pager, err := vpcService.NewBackupPolicyJobsPager(listBackupPolicyJobsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.BackupPolicyJob - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use BackupPolicyJobsPager.GetAll successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - listBackupPolicyJobsOptionsModel := &vpcv1.ListBackupPolicyJobsOptions{ - BackupPolicyID: core.StringPtr("testString"), - Status: core.StringPtr("failed"), - BackupPolicyPlanID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - SourceID: core.StringPtr("testString"), - TargetSnapshotsID: core.StringPtr("testString"), - TargetSnapshotsCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"), - } - - pager, err := vpcService.NewBackupPolicyJobsPager(listBackupPolicyJobsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) - Operation response error`, func() { + Describe(`ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) - Operation response error`, func() { version := "2024-06-23" - getBackupPolicyJobPath := "/backup_policies/testString/jobs/testString" + listVirtualNetworkInterfaceIpsPath := "/virtual_network_interfaces/testString/ips" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBackupPolicyJob with error: Operation response processing error`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62370,20 +70028,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -62393,30 +70053,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions)`, func() { + Describe(`ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions)`, func() { version := "2024-06-23" - getBackupPolicyJobPath := "/backup_policies/testString/jobs/testString" + listVirtualNetworkInterfaceIpsPath := "/virtual_network_interfaces/testString/ips" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke GetBackupPolicyJob successfully with retries`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62426,22 +70089,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) + _, _, operationErr := vpcService.ListVirtualNetworkInterfaceIpsWithContext(ctx, listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -62449,7 +70114,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) + _, _, operationErr = vpcService.ListVirtualNetworkInterfaceIpsWithContext(ctx, listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -62463,18 +70128,21 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::volume:r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "r006-1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-baas-troubleshoot"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke GetBackupPolicyJob successfully`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62484,25 +70152,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBackupPolicyJob(nil) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBackupPolicyJob with error: Operation validation and request error`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62511,23 +70181,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBackupPolicyJobOptions model with no property values - getBackupPolicyJobOptionsModelNew := new(vpcv1.GetBackupPolicyJobOptions) + // Construct a second instance of the ListVirtualNetworkInterfaceIpsOptions model with no property values + listVirtualNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModelNew) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -62545,7 +70217,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBackupPolicyJob successfully`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62554,14 +70226,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -62572,83 +70246,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) - Operation response error`, func() { - version := "2024-06-23" - listBackupPolicyPlansPath := "/backup_policies/testString/plans" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) }) - It(`Invoke ListBackupPolicyPlans with error: Operation response processing error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) }) - AfterEach(func() { - testServer.Close() + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) }) - }) - }) - Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions)`, func() { - version := "2024-06-23" - listBackupPolicyPlansPath := "/backup_policies/testString/plans" - Context(`Using mock server endpoint with timeout`, func() { + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}`) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"ips":[{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"ips":[{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke ListBackupPolicyPlans successfully with retries`, func() { + It(`Use VirtualNetworkInterfaceIpsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62656,58 +70306,70 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := vpcService.ListBackupPolicyPlansWithContext(ctx, listBackupPolicyPlansOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + listVirtualNetworkInterfaceIpsOptionsModel := &vpcv1.ListVirtualNetworkInterfaceIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + pager, err := vpcService.NewVirtualNetworkInterfaceIpsPager(listVirtualNetworkInterfaceIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = vpcService.ListBackupPolicyPlansWithContext(ctx, listBackupPolicyPlansOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + var allResults []vpcv1.ReservedIPReference + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - AfterEach(func() { - testServer.Close() + It(`Use VirtualNetworkInterfaceIpsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listVirtualNetworkInterfaceIpsOptionsModel := &vpcv1.ListVirtualNetworkInterfaceIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewVirtualNetworkInterfaceIpsPager(listVirtualNetworkInterfaceIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) + }) + Describe(`RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions)`, func() { + version := "2024-06-23" + removeVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(removeVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}], "total_count": 132}`) + res.WriteHeader(204) })) }) - It(`Invoke ListBackupPolicyPlans successfully`, func() { + It(`Invoke RemoveVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62717,25 +70379,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBackupPolicyPlans(nil) + response, operationErr := vpcService.RemoveVirtualNetworkInterfaceIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RemoveVirtualNetworkInterfaceIPOptions model + removeVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) + removeVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + removeVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + removeVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + response, operationErr = vpcService.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke ListBackupPolicyPlans with error: Operation validation and request error`, func() { + It(`Invoke RemoveVirtualNetworkInterfaceIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62744,87 +70403,49 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RemoveVirtualNetworkInterfaceIPOptions model + removeVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) + removeVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + removeVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + removeVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + response, operationErr := vpcService.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the ListBackupPolicyPlansOptions model with no property values - listBackupPolicyPlansOptionsModelNew := new(vpcv1.ListBackupPolicyPlansOptions) + // Construct a second instance of the RemoveVirtualNetworkInterfaceIPOptions model with no property values + removeVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModelNew) + response, operationErr = vpcService.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke ListBackupPolicyPlans successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("my-name") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) - Operation response error`, func() { + Describe(`GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) - Operation response error`, func() { version := "2024-06-23" - createBackupPolicyPlanPath := "/backup_policies/testString/plans" + getVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBackupPolicyPlan with error: Operation response processing error`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62833,55 +70454,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -62891,33 +70477,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions)`, func() { + Describe(`GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions)`, func() { version := "2024-06-23" - createBackupPolicyPlanPath := "/backup_policies/testString/plans" + getVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -62926,11 +70496,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}`) })) }) - It(`Invoke CreateBackupPolicyPlan successfully with retries`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -62940,57 +70510,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) + _, _, operationErr := vpcService.GetVirtualNetworkInterfaceIPWithContext(ctx, getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -62998,7 +70533,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) + _, _, operationErr = vpcService.GetVirtualNetworkInterfaceIPWithContext(ctx, getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -63012,34 +70547,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}`) })) }) - It(`Invoke CreateBackupPolicyPlan successfully`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63049,60 +70568,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBackupPolicyPlan(nil) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBackupPolicyPlan with error: Operation validation and request error`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63111,58 +70595,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateBackupPolicyPlanOptions model with no property values - createBackupPolicyPlanOptionsModelNew := new(vpcv1.CreateBackupPolicyPlanOptions) + // Construct a second instance of the GetVirtualNetworkInterfaceIPOptions model with no property values + getVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModelNew) + result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -63177,10 +70626,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateBackupPolicyPlan successfully`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63189,49 +70638,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -63243,27 +70657,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) - Operation response error`, func() { + Describe(`AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) - Operation response error`, func() { version := "2024-06-23" - deleteBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + addVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("DELETE")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteBackupPolicyPlan with error: Operation response processing error`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63272,21 +70684,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -63296,20 +70707,18 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions)`, func() { + Describe(`AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions)`, func() { version := "2024-06-23" - deleteBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + addVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("PUT")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -63317,11 +70726,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}`) })) }) - It(`Invoke DeleteBackupPolicyPlan successfully with retries`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63331,23 +70740,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) + _, _, operationErr := vpcService.AddVirtualNetworkInterfaceIPWithContext(ctx, addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -63355,7 +70763,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) + _, _, operationErr = vpcService.AddVirtualNetworkInterfaceIPWithContext(ctx, addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -63369,20 +70777,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("PUT")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}`) })) }) - It(`Invoke DeleteBackupPolicyPlan successfully`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63392,26 +70798,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteBackupPolicyPlan(nil) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteBackupPolicyPlan with error: Operation validation and request error`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63420,24 +70825,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeleteBackupPolicyPlanOptions model with no property values - deleteBackupPolicyPlanOptionsModelNew := new(vpcv1.DeleteBackupPolicyPlanOptions) + // Construct a second instance of the AddVirtualNetworkInterfaceIPOptions model with no property values + addVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModelNew) + result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -63452,10 +70856,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke DeleteBackupPolicyPlan successfully`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63464,15 +70868,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -63484,25 +70887,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) - Operation response error`, func() { + Describe(`ListClusterNetworkProfiles(listClusterNetworkProfilesOptions *ListClusterNetworkProfilesOptions) - Operation response error`, func() { version := "2024-06-23" - getBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + listClusterNetworkProfilesPath := "/cluster_network/profiles" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkProfilesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBackupPolicyPlan with error: Operation response processing error`, func() { + It(`Invoke ListClusterNetworkProfiles with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63511,20 +70916,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkProfilesOptions model + listClusterNetworkProfilesOptionsModel := new(vpcv1.ListClusterNetworkProfilesOptions) + listClusterNetworkProfilesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkProfiles(listClusterNetworkProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworkProfiles(listClusterNetworkProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -63534,30 +70939,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions)`, func() { + Describe(`ListClusterNetworkProfiles(listClusterNetworkProfilesOptions *ListClusterNetworkProfilesOptions)`, func() { version := "2024-06-23" - getBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + listClusterNetworkProfilesPath := "/cluster_network/profiles" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkProfilesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}], "total_count": 132}`) })) }) - It(`Invoke GetBackupPolicyPlan successfully with retries`, func() { + It(`Invoke ListClusterNetworkProfiles successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63567,22 +70974,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkProfilesOptions model + listClusterNetworkProfilesOptionsModel := new(vpcv1.ListClusterNetworkProfilesOptions) + listClusterNetworkProfilesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) + _, _, operationErr := vpcService.ListClusterNetworkProfilesWithContext(ctx, listClusterNetworkProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkProfiles(listClusterNetworkProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -63590,7 +70997,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) + _, _, operationErr = vpcService.ListClusterNetworkProfilesWithContext(ctx, listClusterNetworkProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -63604,18 +71011,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkProfilesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}], "total_count": 132}`) })) }) - It(`Invoke GetBackupPolicyPlan successfully`, func() { + It(`Invoke ListClusterNetworkProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63625,25 +71034,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBackupPolicyPlan(nil) + result, response, operationErr := vpcService.ListClusterNetworkProfiles(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkProfilesOptions model + listClusterNetworkProfilesOptionsModel := new(vpcv1.ListClusterNetworkProfilesOptions) + listClusterNetworkProfilesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworkProfiles(listClusterNetworkProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBackupPolicyPlan with error: Operation validation and request error`, func() { + It(`Invoke ListClusterNetworkProfiles with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63652,26 +71061,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkProfilesOptions model + listClusterNetworkProfilesOptionsModel := new(vpcv1.ListClusterNetworkProfilesOptions) + listClusterNetworkProfilesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkProfiles(listClusterNetworkProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBackupPolicyPlanOptions model with no property values - getBackupPolicyPlanOptionsModelNew := new(vpcv1.GetBackupPolicyPlanOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -63686,7 +71088,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBackupPolicyPlan successfully`, func() { + It(`Invoke ListClusterNetworkProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63695,14 +71097,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkProfilesOptions model + listClusterNetworkProfilesOptionsModel := new(vpcv1.ListClusterNetworkProfilesOptions) + listClusterNetworkProfilesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkProfiles(listClusterNetworkProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -63713,28 +71115,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) - Operation response error`, func() { - version := "2024-06-23" - updateBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ClusterNetworkProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ClusterNetworkProfileCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ClusterNetworkProfileCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) - Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}]}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"family":"vela","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16","resource_type":"instance_profile"}],"zones":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}]}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke UpdateBackupPolicyPlan with error: Operation response processing error`, func() { + It(`Use ClusterNetworkProfilesPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63743,63 +71176,87 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") + listClusterNetworkProfilesOptionsModel := &vpcv1.ListClusterNetworkProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + pager, err := vpcService.NewClusterNetworkProfilesPager(listClusterNetworkProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) + var allResults []vpcv1.ClusterNetworkProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ClusterNetworkProfilesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + listClusterNetworkProfilesOptionsModel := &vpcv1.ListClusterNetworkProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") + pager, err := vpcService.NewClusterNetworkProfilesPager(listClusterNetworkProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`GetClusterNetworkProfile(getClusterNetworkProfileOptions *GetClusterNetworkProfileOptions) - Operation response error`, func() { + version := "2024-06-23" + getClusterNetworkProfilePath := "/cluster_network/profiles/h100" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkProfilePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetClusterNetworkProfile with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkProfileOptions model + getClusterNetworkProfileOptionsModel := new(vpcv1.GetClusterNetworkProfileOptions) + getClusterNetworkProfileOptionsModel.Name = core.StringPtr("h100") + getClusterNetworkProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkProfile(getClusterNetworkProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.GetClusterNetworkProfile(getClusterNetworkProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -63809,36 +71266,18 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions)`, func() { + Describe(`GetClusterNetworkProfile(getClusterNetworkProfileOptions *GetClusterNetworkProfileOptions)`, func() { version := "2024-06-23" - updateBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + getClusterNetworkProfilePath := "/cluster_network/profiles/h100" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkProfilePath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -63847,10 +71286,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}`) })) }) - It(`Invoke UpdateBackupPolicyPlan successfully with retries`, func() { + It(`Invoke GetClusterNetworkProfile successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63860,65 +71299,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkProfileOptions model + getClusterNetworkProfileOptionsModel := new(vpcv1.GetClusterNetworkProfileOptions) + getClusterNetworkProfileOptionsModel.Name = core.StringPtr("h100") + getClusterNetworkProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) + _, _, operationErr := vpcService.GetClusterNetworkProfileWithContext(ctx, getClusterNetworkProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkProfile(getClusterNetworkProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -63926,7 +71321,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) + _, _, operationErr = vpcService.GetClusterNetworkProfileWithContext(ctx, getClusterNetworkProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -63940,36 +71335,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkProfilePath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"family": "vela", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16", "resource_type": "instance_profile"}], "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}`) })) }) - It(`Invoke UpdateBackupPolicyPlan successfully`, func() { + It(`Invoke GetClusterNetworkProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -63979,136 +71356,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBackupPolicyPlan(nil) + result, response, operationErr := vpcService.GetClusterNetworkProfile(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkProfileOptions model + getClusterNetworkProfileOptionsModel := new(vpcv1.GetClusterNetworkProfileOptions) + getClusterNetworkProfileOptionsModel.Name = core.StringPtr("h100") + getClusterNetworkProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.GetClusterNetworkProfile(getClusterNetworkProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBackupPolicyPlan with error: Operation validation and request error`, func() { + It(`Invoke GetClusterNetworkProfile with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkProfileOptions model + getClusterNetworkProfileOptionsModel := new(vpcv1.GetClusterNetworkProfileOptions) + getClusterNetworkProfileOptionsModel.Name = core.StringPtr("h100") + getClusterNetworkProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkProfile(getClusterNetworkProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateBackupPolicyPlanOptions model with no property values - updateBackupPolicyPlanOptionsModelNew := new(vpcv1.UpdateBackupPolicyPlanOptions) + // Construct a second instance of the GetClusterNetworkProfileOptions model with no property values + getClusterNetworkProfileOptionsModelNew := new(vpcv1.GetClusterNetworkProfileOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModelNew) + result, response, operationErr = vpcService.GetClusterNetworkProfile(getClusterNetworkProfileOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -64126,7 +71415,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBackupPolicyPlan successfully`, func() { + It(`Invoke GetClusterNetworkProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64135,57 +71424,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkProfileOptions model + getClusterNetworkProfileOptionsModel := new(vpcv1.GetClusterNetworkProfileOptions) + getClusterNetworkProfileOptionsModel.Name = core.StringPtr("h100") + getClusterNetworkProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkProfile(getClusterNetworkProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -64197,27 +71442,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) - Operation response error`, func() { + Describe(`ListClusterNetworks(listClusterNetworksOptions *ListClusterNetworksOptions) - Operation response error`, func() { version := "2024-06-23" - deleteBackupPolicyPath := "/backup_policies/testString" + listClusterNetworksPath := "/cluster_networks" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPath)) - Expect(req.Method).To(Equal("DELETE")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworksPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteBackupPolicy with error: Operation response processing error`, func() { + It(`Invoke ListClusterNetworks with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64226,20 +71477,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworksOptions model + listClusterNetworksOptionsModel := new(vpcv1.ListClusterNetworksOptions) + listClusterNetworksOptionsModel.Start = core.StringPtr("testString") + listClusterNetworksOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworksOptionsModel.ResourceGroupID = core.StringPtr("testString") + listClusterNetworksOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworksOptionsModel.Sort = core.StringPtr("name") + listClusterNetworksOptionsModel.VPCID = core.StringPtr("testString") + listClusterNetworksOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listClusterNetworksOptionsModel.VPCName = core.StringPtr("my-vpc") + listClusterNetworksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworks(listClusterNetworksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworks(listClusterNetworksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -64249,32 +71506,38 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions)`, func() { + Describe(`ListClusterNetworks(listClusterNetworksOptions *ListClusterNetworksOptions)`, func() { version := "2024-06-23" - deleteBackupPolicyPath := "/backup_policies/testString" + listClusterNetworksPath := "/cluster_networks" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworksPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"cluster_networks": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke DeleteBackupPolicy successfully with retries`, func() { + It(`Invoke ListClusterNetworks successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64284,22 +71547,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworksOptions model + listClusterNetworksOptionsModel := new(vpcv1.ListClusterNetworksOptions) + listClusterNetworksOptionsModel.Start = core.StringPtr("testString") + listClusterNetworksOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworksOptionsModel.ResourceGroupID = core.StringPtr("testString") + listClusterNetworksOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworksOptionsModel.Sort = core.StringPtr("name") + listClusterNetworksOptionsModel.VPCID = core.StringPtr("testString") + listClusterNetworksOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listClusterNetworksOptionsModel.VPCName = core.StringPtr("my-vpc") + listClusterNetworksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) + _, _, operationErr := vpcService.ListClusterNetworksWithContext(ctx, listClusterNetworksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworks(listClusterNetworksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -64307,7 +71576,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) + _, _, operationErr = vpcService.ListClusterNetworksWithContext(ctx, listClusterNetworksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -64321,20 +71590,26 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworksPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"cluster_networks": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke DeleteBackupPolicy successfully`, func() { + It(`Invoke ListClusterNetworks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64344,25 +71619,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteBackupPolicy(nil) + result, response, operationErr := vpcService.ListClusterNetworks(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworksOptions model + listClusterNetworksOptionsModel := new(vpcv1.ListClusterNetworksOptions) + listClusterNetworksOptionsModel.Start = core.StringPtr("testString") + listClusterNetworksOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworksOptionsModel.ResourceGroupID = core.StringPtr("testString") + listClusterNetworksOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworksOptionsModel.Sort = core.StringPtr("name") + listClusterNetworksOptionsModel.VPCID = core.StringPtr("testString") + listClusterNetworksOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listClusterNetworksOptionsModel.VPCName = core.StringPtr("my-vpc") + listClusterNetworksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworks(listClusterNetworksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteBackupPolicy with error: Operation validation and request error`, func() { + It(`Invoke ListClusterNetworks with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64371,26 +71652,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworksOptions model + listClusterNetworksOptionsModel := new(vpcv1.ListClusterNetworksOptions) + listClusterNetworksOptionsModel.Start = core.StringPtr("testString") + listClusterNetworksOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworksOptionsModel.ResourceGroupID = core.StringPtr("testString") + listClusterNetworksOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworksOptionsModel.Sort = core.StringPtr("name") + listClusterNetworksOptionsModel.VPCID = core.StringPtr("testString") + listClusterNetworksOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listClusterNetworksOptionsModel.VPCName = core.StringPtr("my-vpc") + listClusterNetworksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworks(listClusterNetworksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeleteBackupPolicyOptions model with no property values - deleteBackupPolicyOptionsModelNew := new(vpcv1.DeleteBackupPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -64402,10 +71682,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke DeleteBackupPolicy successfully`, func() { + It(`Invoke ListClusterNetworks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64414,14 +71694,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworksOptions model + listClusterNetworksOptionsModel := new(vpcv1.ListClusterNetworksOptions) + listClusterNetworksOptionsModel.Start = core.StringPtr("testString") + listClusterNetworksOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworksOptionsModel.ResourceGroupID = core.StringPtr("testString") + listClusterNetworksOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworksOptionsModel.Sort = core.StringPtr("name") + listClusterNetworksOptionsModel.VPCID = core.StringPtr("testString") + listClusterNetworksOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listClusterNetworksOptionsModel.VPCName = core.StringPtr("my-vpc") + listClusterNetworksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworks(listClusterNetworksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -64432,26 +71718,139 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ClusterNetworkCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ClusterNetworkCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ClusterNetworkCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworksPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"cluster_networks":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573","id":"0717-da0df18c-7598-4633-a648-fdaac28a5573","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100","name":"h100","resource_type":"cluster_network_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"cluster_network","subnet_prefixes":[{"allocation_policy":"auto","cidr":"10.0.0.0/24"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use ClusterNetworksPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listClusterNetworksOptionsModel := &vpcv1.ListClusterNetworksOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"), + VPCName: core.StringPtr("my-vpc"), + } + + pager, err := vpcService.NewClusterNetworksPager(listClusterNetworksOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ClusterNetwork + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ClusterNetworksPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listClusterNetworksOptionsModel := &vpcv1.ListClusterNetworksOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"), + VPCName: core.StringPtr("my-vpc"), + } + + pager, err := vpcService.NewClusterNetworksPager(listClusterNetworksOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) - Operation response error`, func() { + Describe(`CreateClusterNetwork(createClusterNetworkOptions *CreateClusterNetworkOptions) - Operation response error`, func() { version := "2024-06-23" - getBackupPolicyPath := "/backup_policies/testString" + createClusterNetworkPath := "/cluster_networks" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBackupPolicy with error: Operation response processing error`, func() { + It(`Invoke CreateClusterNetwork with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64460,19 +71859,44 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkProfileIdentityByName model + clusterNetworkProfileIdentityModel := new(vpcv1.ClusterNetworkProfileIdentityByName) + clusterNetworkProfileIdentityModel.Name = core.StringPtr("h100") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ClusterNetworkSubnetPrefixPrototype model + clusterNetworkSubnetPrefixPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrefixPrototype) + clusterNetworkSubnetPrefixPrototypeModel.CIDR = core.StringPtr("10.0.0.0/24") + + // Construct an instance of the CreateClusterNetworkOptions model + createClusterNetworkOptionsModel := new(vpcv1.CreateClusterNetworkOptions) + createClusterNetworkOptionsModel.Profile = clusterNetworkProfileIdentityModel + createClusterNetworkOptionsModel.VPC = vpcIdentityModel + createClusterNetworkOptionsModel.Zone = zoneIdentityModel + createClusterNetworkOptionsModel.Name = core.StringPtr("my-cluster-network") + createClusterNetworkOptionsModel.ResourceGroup = resourceGroupIdentityModel + createClusterNetworkOptionsModel.SubnetPrefixes = []vpcv1.ClusterNetworkSubnetPrefixPrototype{*clusterNetworkSubnetPrefixPrototypeModel} + createClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetwork(createClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetwork(createClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -64482,17 +71906,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions)`, func() { + Describe(`CreateClusterNetwork(createClusterNetworkOptions *CreateClusterNetworkOptions)`, func() { version := "2024-06-23" - getBackupPolicyPath := "/backup_policies/testString" + createClusterNetworkPath := "/cluster_networks" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -64501,11 +71941,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetBackupPolicy successfully with retries`, func() { + It(`Invoke CreateClusterNetwork successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64515,21 +71955,46 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkProfileIdentityByName model + clusterNetworkProfileIdentityModel := new(vpcv1.ClusterNetworkProfileIdentityByName) + clusterNetworkProfileIdentityModel.Name = core.StringPtr("h100") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ClusterNetworkSubnetPrefixPrototype model + clusterNetworkSubnetPrefixPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrefixPrototype) + clusterNetworkSubnetPrefixPrototypeModel.CIDR = core.StringPtr("10.0.0.0/24") + + // Construct an instance of the CreateClusterNetworkOptions model + createClusterNetworkOptionsModel := new(vpcv1.CreateClusterNetworkOptions) + createClusterNetworkOptionsModel.Profile = clusterNetworkProfileIdentityModel + createClusterNetworkOptionsModel.VPC = vpcIdentityModel + createClusterNetworkOptionsModel.Zone = zoneIdentityModel + createClusterNetworkOptionsModel.Name = core.StringPtr("my-cluster-network") + createClusterNetworkOptionsModel.ResourceGroup = resourceGroupIdentityModel + createClusterNetworkOptionsModel.SubnetPrefixes = []vpcv1.ClusterNetworkSubnetPrefixPrototype{*clusterNetworkSubnetPrefixPrototypeModel} + createClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) + _, _, operationErr := vpcService.CreateClusterNetworkWithContext(ctx, createClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetwork(createClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -64537,7 +72002,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) + _, _, operationErr = vpcService.CreateClusterNetworkWithContext(ctx, createClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -64551,18 +72016,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetBackupPolicy successfully`, func() { + It(`Invoke CreateClusterNetwork successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64572,24 +72053,49 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBackupPolicy(nil) + result, response, operationErr := vpcService.CreateClusterNetwork(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkProfileIdentityByName model + clusterNetworkProfileIdentityModel := new(vpcv1.ClusterNetworkProfileIdentityByName) + clusterNetworkProfileIdentityModel.Name = core.StringPtr("h100") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ClusterNetworkSubnetPrefixPrototype model + clusterNetworkSubnetPrefixPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrefixPrototype) + clusterNetworkSubnetPrefixPrototypeModel.CIDR = core.StringPtr("10.0.0.0/24") + + // Construct an instance of the CreateClusterNetworkOptions model + createClusterNetworkOptionsModel := new(vpcv1.CreateClusterNetworkOptions) + createClusterNetworkOptionsModel.Profile = clusterNetworkProfileIdentityModel + createClusterNetworkOptionsModel.VPC = vpcIdentityModel + createClusterNetworkOptionsModel.Zone = zoneIdentityModel + createClusterNetworkOptionsModel.Name = core.StringPtr("my-cluster-network") + createClusterNetworkOptionsModel.ResourceGroup = resourceGroupIdentityModel + createClusterNetworkOptionsModel.SubnetPrefixes = []vpcv1.ClusterNetworkSubnetPrefixPrototype{*clusterNetworkSubnetPrefixPrototypeModel} + createClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetwork(createClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBackupPolicy with error: Operation validation and request error`, func() { + It(`Invoke CreateClusterNetwork with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64598,22 +72104,47 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkProfileIdentityByName model + clusterNetworkProfileIdentityModel := new(vpcv1.ClusterNetworkProfileIdentityByName) + clusterNetworkProfileIdentityModel.Name = core.StringPtr("h100") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ClusterNetworkSubnetPrefixPrototype model + clusterNetworkSubnetPrefixPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrefixPrototype) + clusterNetworkSubnetPrefixPrototypeModel.CIDR = core.StringPtr("10.0.0.0/24") + + // Construct an instance of the CreateClusterNetworkOptions model + createClusterNetworkOptionsModel := new(vpcv1.CreateClusterNetworkOptions) + createClusterNetworkOptionsModel.Profile = clusterNetworkProfileIdentityModel + createClusterNetworkOptionsModel.VPC = vpcIdentityModel + createClusterNetworkOptionsModel.Zone = zoneIdentityModel + createClusterNetworkOptionsModel.Name = core.StringPtr("my-cluster-network") + createClusterNetworkOptionsModel.ResourceGroup = resourceGroupIdentityModel + createClusterNetworkOptionsModel.SubnetPrefixes = []vpcv1.ClusterNetworkSubnetPrefixPrototype{*clusterNetworkSubnetPrefixPrototypeModel} + createClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetwork(createClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBackupPolicyOptions model with no property values - getBackupPolicyOptionsModelNew := new(vpcv1.GetBackupPolicyOptions) + // Construct a second instance of the CreateClusterNetworkOptions model with no property values + createClusterNetworkOptionsModelNew := new(vpcv1.CreateClusterNetworkOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModelNew) + result, response, operationErr = vpcService.CreateClusterNetwork(createClusterNetworkOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -64628,10 +72159,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetBackupPolicy successfully`, func() { + It(`Invoke CreateClusterNetwork successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64640,13 +72171,38 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkProfileIdentityByName model + clusterNetworkProfileIdentityModel := new(vpcv1.ClusterNetworkProfileIdentityByName) + clusterNetworkProfileIdentityModel.Name = core.StringPtr("h100") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ClusterNetworkSubnetPrefixPrototype model + clusterNetworkSubnetPrefixPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrefixPrototype) + clusterNetworkSubnetPrefixPrototypeModel.CIDR = core.StringPtr("10.0.0.0/24") + + // Construct an instance of the CreateClusterNetworkOptions model + createClusterNetworkOptionsModel := new(vpcv1.CreateClusterNetworkOptions) + createClusterNetworkOptionsModel.Profile = clusterNetworkProfileIdentityModel + createClusterNetworkOptionsModel.VPC = vpcIdentityModel + createClusterNetworkOptionsModel.Zone = zoneIdentityModel + createClusterNetworkOptionsModel.Name = core.StringPtr("my-cluster-network") + createClusterNetworkOptionsModel.ResourceGroup = resourceGroupIdentityModel + createClusterNetworkOptionsModel.SubnetPrefixes = []vpcv1.ClusterNetworkSubnetPrefixPrototype{*clusterNetworkSubnetPrefixPrototypeModel} + createClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetwork(createClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -64658,27 +72214,29 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) - Operation response error`, func() { + Describe(`ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptions *ListClusterNetworkInterfacesOptions) - Operation response error`, func() { version := "2024-06-23" - updateBackupPolicyPath := "/backup_policies/testString" + listClusterNetworkInterfacesPath := "/cluster_networks/testString/interfaces" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBackupPolicy with error: Operation response processing error`, func() { + It(`Invoke ListClusterNetworkInterfaces with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64687,29 +72245,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkInterfacesOptions model + listClusterNetworkInterfacesOptionsModel := new(vpcv1.ListClusterNetworkInterfacesOptions) + listClusterNetworkInterfacesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkInterfacesOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkInterfacesOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -64719,48 +72271,34 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions)`, func() { + Describe(`ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptions *ListClusterNetworkInterfacesOptions)`, func() { version := "2024-06-23" - updateBackupPolicyPath := "/backup_policies/testString" + listClusterNetworkInterfacesPath := "/cluster_networks/testString/interfaces" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke UpdateBackupPolicy successfully with retries`, func() { + It(`Invoke ListClusterNetworkInterfaces successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64770,31 +72308,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkInterfacesOptions model + listClusterNetworkInterfacesOptionsModel := new(vpcv1.ListClusterNetworkInterfacesOptions) + listClusterNetworkInterfacesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkInterfacesOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkInterfacesOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) + _, _, operationErr := vpcService.ListClusterNetworkInterfacesWithContext(ctx, listClusterNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -64802,7 +72334,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) + _, _, operationErr = vpcService.ListClusterNetworkInterfacesWithContext(ctx, listClusterNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -64816,36 +72348,22 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/aa2432b1fa4d4ace891e9b80fc104e34::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) - It(`Invoke UpdateBackupPolicy successfully`, func() { + It(`Invoke ListClusterNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64855,34 +72373,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBackupPolicy(nil) + result, response, operationErr := vpcService.ListClusterNetworkInterfaces(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkInterfacesOptions model + listClusterNetworkInterfacesOptionsModel := new(vpcv1.ListClusterNetworkInterfacesOptions) + listClusterNetworkInterfacesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkInterfacesOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkInterfacesOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBackupPolicy with error: Operation validation and request error`, func() { + It(`Invoke ListClusterNetworkInterfaces with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64891,32 +72403,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkInterfacesOptions model + listClusterNetworkInterfacesOptionsModel := new(vpcv1.ListClusterNetworkInterfacesOptions) + listClusterNetworkInterfacesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkInterfacesOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkInterfacesOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateBackupPolicyOptions model with no property values - updateBackupPolicyOptionsModelNew := new(vpcv1.UpdateBackupPolicyOptions) + // Construct a second instance of the ListClusterNetworkInterfacesOptions model with no property values + listClusterNetworkInterfacesOptionsModelNew := new(vpcv1.ListClusterNetworkInterfacesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModelNew) + result, response, operationErr = vpcService.ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -64934,7 +72440,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBackupPolicy successfully`, func() { + It(`Invoke ListClusterNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64943,23 +72449,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkInterfacesOptions model + listClusterNetworkInterfacesOptionsModel := new(vpcv1.ListClusterNetworkInterfacesOptions) + listClusterNetworkInterfacesOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkInterfacesOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkInterfacesOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -64970,26 +72470,133 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ClusterNetworkInterfaceCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ClusterNetworkInterfaceCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ClusterNetworkInterfaceCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-cluster-network-interface","primary_ip":{"address":"10.1.0.6","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-cluster-network-subnet-reserved-ip","resource_type":"cluster_network_subnet_reserved_ip"},"resource_type":"cluster_network_interface","subnet":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet"},"target":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213","id":"0717-fb880975-db45-4459-8548-64e3995ac213","name":"my-instance-network-attachment","resource_type":"instance_cluster_network_attachment"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use ClusterNetworkInterfacesPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listClusterNetworkInterfacesOptionsModel := &vpcv1.ListClusterNetworkInterfacesOptions{ + ClusterNetworkID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewClusterNetworkInterfacesPager(listClusterNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ClusterNetworkInterface + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ClusterNetworkInterfacesPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listClusterNetworkInterfacesOptionsModel := &vpcv1.ListClusterNetworkInterfacesOptions{ + ClusterNetworkID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewClusterNetworkInterfacesPager(listClusterNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`ListRegions(listRegionsOptions *ListRegionsOptions) - Operation response error`, func() { + Describe(`CreateClusterNetworkInterface(createClusterNetworkInterfaceOptions *CreateClusterNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - listRegionsPath := "/regions" + createClusterNetworkInterfacePath := "/cluster_networks/testString/interfaces" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListRegions with error: Operation response processing error`, func() { + It(`Invoke CreateClusterNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -64998,18 +72605,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the CreateClusterNetworkInterfaceOptions model + createClusterNetworkInterfaceOptionsModel := new(vpcv1.CreateClusterNetworkInterfaceOptions) + createClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkInterfaceOptionsModel.Name = core.StringPtr("my-cluster-network-interface") + createClusterNetworkInterfaceOptionsModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + createClusterNetworkInterfaceOptionsModel.Subnet = clusterNetworkSubnetIdentityModel + createClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkInterface(createClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetworkInterface(createClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -65019,17 +72640,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListRegions(listRegionsOptions *ListRegionsOptions)`, func() { + Describe(`CreateClusterNetworkInterface(createClusterNetworkInterfaceOptions *CreateClusterNetworkInterfaceOptions)`, func() { version := "2024-06-23" - listRegionsPath := "/regions" + createClusterNetworkInterfacePath := "/cluster_networks/testString/interfaces" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -65038,11 +72675,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"regions": [{"endpoint": "https://eu-gb.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListRegions successfully with retries`, func() { + It(`Invoke CreateClusterNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65052,20 +72689,34 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the CreateClusterNetworkInterfaceOptions model + createClusterNetworkInterfaceOptionsModel := new(vpcv1.CreateClusterNetworkInterfaceOptions) + createClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkInterfaceOptionsModel.Name = core.StringPtr("my-cluster-network-interface") + createClusterNetworkInterfaceOptionsModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + createClusterNetworkInterfaceOptionsModel.Subnet = clusterNetworkSubnetIdentityModel + createClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListRegionsWithContext(ctx, listRegionsOptionsModel) + _, _, operationErr := vpcService.CreateClusterNetworkInterfaceWithContext(ctx, createClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkInterface(createClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -65073,7 +72724,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListRegionsWithContext(ctx, listRegionsOptionsModel) + _, _, operationErr = vpcService.CreateClusterNetworkInterfaceWithContext(ctx, createClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -65087,18 +72738,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"regions": [{"endpoint": "https://eu-gb.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListRegions successfully`, func() { + It(`Invoke CreateClusterNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65108,23 +72775,37 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListRegions(nil) + result, response, operationErr := vpcService.CreateClusterNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the CreateClusterNetworkInterfaceOptions model + createClusterNetworkInterfaceOptionsModel := new(vpcv1.CreateClusterNetworkInterfaceOptions) + createClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkInterfaceOptionsModel.Name = core.StringPtr("my-cluster-network-interface") + createClusterNetworkInterfaceOptionsModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + createClusterNetworkInterfaceOptionsModel.Subnet = clusterNetworkSubnetIdentityModel + createClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetworkInterface(createClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListRegions with error: Operation request error`, func() { + It(`Invoke CreateClusterNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65133,17 +72814,38 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the CreateClusterNetworkInterfaceOptions model + createClusterNetworkInterfaceOptionsModel := new(vpcv1.CreateClusterNetworkInterfaceOptions) + createClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkInterfaceOptionsModel.Name = core.StringPtr("my-cluster-network-interface") + createClusterNetworkInterfaceOptionsModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + createClusterNetworkInterfaceOptionsModel.Subnet = clusterNetworkSubnetIdentityModel + createClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkInterface(createClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the CreateClusterNetworkInterfaceOptions model with no property values + createClusterNetworkInterfaceOptionsModelNew := new(vpcv1.CreateClusterNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateClusterNetworkInterface(createClusterNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -65155,10 +72857,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListRegions successfully`, func() { + It(`Invoke CreateClusterNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65167,12 +72869,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + // Construct an instance of the CreateClusterNetworkInterfaceOptions model + createClusterNetworkInterfaceOptionsModel := new(vpcv1.CreateClusterNetworkInterfaceOptions) + createClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkInterfaceOptionsModel.Name = core.StringPtr("my-cluster-network-interface") + createClusterNetworkInterfaceOptionsModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + createClusterNetworkInterfaceOptionsModel.Subnet = clusterNetworkSubnetIdentityModel + createClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkInterface(createClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -65184,25 +72900,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetRegion(getRegionOptions *GetRegionOptions) - Operation response error`, func() { + Describe(`DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptions *DeleteClusterNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - getRegionPath := "/regions/us-south" + deleteClusterNetworkInterfacePath := "/cluster_networks/testString/interfaces/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetRegion with error: Operation response processing error`, func() { + It(`Invoke DeleteClusterNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65211,19 +72929,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("us-south") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkInterfaceOptions model + deleteClusterNetworkInterfaceOptionsModel := new(vpcv1.DeleteClusterNetworkInterfaceOptions) + deleteClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr = vpcService.DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -65233,18 +72953,20 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetRegion(getRegionOptions *GetRegionOptions)`, func() { + Describe(`DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptions *DeleteClusterNetworkInterfaceOptions)`, func() { version := "2024-06-23" - getRegionPath := "/regions/us-south" + deleteClusterNetworkInterfacePath := "/cluster_networks/testString/interfaces/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -65252,11 +72974,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoint": "https://eu-gb.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetRegion successfully with retries`, func() { + It(`Invoke DeleteClusterNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65266,21 +72988,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("us-south") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkInterfaceOptions model + deleteClusterNetworkInterfaceOptionsModel := new(vpcv1.DeleteClusterNetworkInterfaceOptions) + deleteClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetRegionWithContext(ctx, getRegionOptionsModel) + _, _, operationErr := vpcService.DeleteClusterNetworkInterfaceWithContext(ctx, deleteClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -65288,7 +73012,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetRegionWithContext(ctx, getRegionOptionsModel) + _, _, operationErr = vpcService.DeleteClusterNetworkInterfaceWithContext(ctx, deleteClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -65302,18 +73026,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoint": "https://eu-gb.iaas.cloud.ibm.com", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetRegion successfully`, func() { + It(`Invoke DeleteClusterNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65323,24 +73049,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetRegion(nil) + result, response, operationErr := vpcService.DeleteClusterNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("us-south") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkInterfaceOptions model + deleteClusterNetworkInterfaceOptionsModel := new(vpcv1.DeleteClusterNetworkInterfaceOptions) + deleteClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr = vpcService.DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetRegion with error: Operation validation and request error`, func() { + It(`Invoke DeleteClusterNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65349,22 +73077,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("us-south") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkInterfaceOptions model + deleteClusterNetworkInterfaceOptionsModel := new(vpcv1.DeleteClusterNetworkInterfaceOptions) + deleteClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetRegionOptions model with no property values - getRegionOptionsModelNew := new(vpcv1.GetRegionOptions) + // Construct a second instance of the DeleteClusterNetworkInterfaceOptions model with no property values + deleteClusterNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteClusterNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetRegion(getRegionOptionsModelNew) + result, response, operationErr = vpcService.DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -65379,10 +73109,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke GetRegion successfully`, func() { + It(`Invoke DeleteClusterNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65391,13 +73121,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("us-south") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkInterfaceOptions model + deleteClusterNetworkInterfaceOptionsModel := new(vpcv1.DeleteClusterNetworkInterfaceOptions) + deleteClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -65409,16 +73141,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) - Operation response error`, func() { + Describe(`GetClusterNetworkInterface(getClusterNetworkInterfaceOptions *GetClusterNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - listRegionZonesPath := "/regions/us-south/zones" + getClusterNetworkInterfacePath := "/cluster_networks/testString/interfaces/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listRegionZonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkInterfacePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -65427,7 +73159,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListRegionZones with error: Operation response processing error`, func() { + It(`Invoke GetClusterNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65436,19 +73168,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkInterfaceOptions model + getClusterNetworkInterfaceOptionsModel := new(vpcv1.GetClusterNetworkInterfaceOptions) + getClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkInterface(getClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr = vpcService.GetClusterNetworkInterface(getClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -65458,16 +73191,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions)`, func() { + Describe(`GetClusterNetworkInterface(getClusterNetworkInterfaceOptions *GetClusterNetworkInterfaceOptions)`, func() { version := "2024-06-23" - listRegionZonesPath := "/regions/us-south/zones" + getClusterNetworkInterfacePath := "/cluster_networks/testString/interfaces/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listRegionZonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkInterfacePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -65478,10 +73211,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"zones": [{"data_center": "DAL12", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available", "universal_name": "us-south-dal10-a"}]}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListRegionZones successfully with retries`, func() { + It(`Invoke GetClusterNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65491,21 +73224,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkInterfaceOptions model + getClusterNetworkInterfaceOptionsModel := new(vpcv1.GetClusterNetworkInterfaceOptions) + getClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) + _, _, operationErr := vpcService.GetClusterNetworkInterfaceWithContext(ctx, getClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkInterface(getClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -65513,7 +73247,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) + _, _, operationErr = vpcService.GetClusterNetworkInterfaceWithContext(ctx, getClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -65527,7 +73261,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listRegionZonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkInterfacePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -65535,10 +73269,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"zones": [{"data_center": "DAL12", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available", "universal_name": "us-south-dal10-a"}]}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListRegionZones successfully`, func() { + It(`Invoke GetClusterNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65548,24 +73282,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListRegionZones(nil) + result, response, operationErr := vpcService.GetClusterNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkInterfaceOptions model + getClusterNetworkInterfaceOptionsModel := new(vpcv1.GetClusterNetworkInterfaceOptions) + getClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr = vpcService.GetClusterNetworkInterface(getClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListRegionZones with error: Operation validation and request error`, func() { + It(`Invoke GetClusterNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65574,22 +73309,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkInterfaceOptions model + getClusterNetworkInterfaceOptionsModel := new(vpcv1.GetClusterNetworkInterfaceOptions) + getClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkInterface(getClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListRegionZonesOptions model with no property values - listRegionZonesOptionsModelNew := new(vpcv1.ListRegionZonesOptions) + // Construct a second instance of the GetClusterNetworkInterfaceOptions model with no property values + getClusterNetworkInterfaceOptionsModelNew := new(vpcv1.GetClusterNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModelNew) + result, response, operationErr = vpcService.GetClusterNetworkInterface(getClusterNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -65607,7 +73343,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListRegionZones successfully`, func() { + It(`Invoke GetClusterNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65616,13 +73352,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("us-south") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkInterfaceOptions model + getClusterNetworkInterfaceOptionsModel := new(vpcv1.GetClusterNetworkInterfaceOptions) + getClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkInterface(getClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -65634,17 +73371,19 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) - Operation response error`, func() { + Describe(`UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptions *UpdateClusterNetworkInterfaceOptions) - Operation response error`, func() { version := "2024-06-23" - getRegionZonePath := "/regions/us-south/zones/us-south-1" + updateClusterNetworkInterfacePath := "/cluster_networks/testString/interfaces/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -65652,7 +73391,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetRegionZone with error: Operation response processing error`, func() { + It(`Invoke UpdateClusterNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65661,20 +73400,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") - getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePatch model + clusterNetworkInterfacePatchModel := new(vpcv1.ClusterNetworkInterfacePatch) + clusterNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePatchModel.Name = core.StringPtr("my-cluster-network-interface") + clusterNetworkInterfacePatchModelAsPatch, asPatchErr := clusterNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkInterfaceOptions model + updateClusterNetworkInterfaceOptionsModel := new(vpcv1.UpdateClusterNetworkInterfaceOptions) + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkInterfacePatch = clusterNetworkInterfacePatchModelAsPatch + updateClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr = vpcService.UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -65684,18 +73432,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions)`, func() { + Describe(`UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptions *UpdateClusterNetworkInterfaceOptions)`, func() { version := "2024-06-23" - getRegionZonePath := "/regions/us-south/zones/us-south-1" + updateClusterNetworkInterfacePath := "/cluster_networks/testString/interfaces/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -65704,10 +73470,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"data_center": "DAL12", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available", "universal_name": "us-south-dal10-a"}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetRegionZone successfully with retries`, func() { + It(`Invoke UpdateClusterNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65717,22 +73483,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") - getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePatch model + clusterNetworkInterfacePatchModel := new(vpcv1.ClusterNetworkInterfacePatch) + clusterNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePatchModel.Name = core.StringPtr("my-cluster-network-interface") + clusterNetworkInterfacePatchModelAsPatch, asPatchErr := clusterNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkInterfaceOptions model + updateClusterNetworkInterfaceOptionsModel := new(vpcv1.UpdateClusterNetworkInterfaceOptions) + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkInterfacePatch = clusterNetworkInterfacePatchModelAsPatch + updateClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetRegionZoneWithContext(ctx, getRegionZoneOptionsModel) + _, _, operationErr := vpcService.UpdateClusterNetworkInterfaceWithContext(ctx, updateClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -65740,7 +73515,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetRegionZoneWithContext(ctx, getRegionZoneOptionsModel) + _, _, operationErr = vpcService.UpdateClusterNetworkInterfaceWithContext(ctx, updateClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -65754,18 +73529,36 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"data_center": "DAL12", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available", "universal_name": "us-south-dal10-a"}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-cluster-network-interface", "primary_ip": {"address": "10.1.0.6", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-cluster-network-subnet-reserved-ip", "resource_type": "cluster_network_subnet_reserved_ip"}, "resource_type": "cluster_network_interface", "subnet": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet"}, "target": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213", "id": "0717-fb880975-db45-4459-8548-64e3995ac213", "name": "my-instance-network-attachment", "resource_type": "instance_cluster_network_attachment"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetRegionZone successfully`, func() { + It(`Invoke UpdateClusterNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65775,25 +73568,34 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetRegionZone(nil) + result, response, operationErr := vpcService.UpdateClusterNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") - getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePatch model + clusterNetworkInterfacePatchModel := new(vpcv1.ClusterNetworkInterfacePatch) + clusterNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePatchModel.Name = core.StringPtr("my-cluster-network-interface") + clusterNetworkInterfacePatchModelAsPatch, asPatchErr := clusterNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkInterfaceOptions model + updateClusterNetworkInterfaceOptionsModel := new(vpcv1.UpdateClusterNetworkInterfaceOptions) + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkInterfacePatch = clusterNetworkInterfacePatchModelAsPatch + updateClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr = vpcService.UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetRegionZone with error: Operation validation and request error`, func() { + It(`Invoke UpdateClusterNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65802,23 +73604,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") - getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePatch model + clusterNetworkInterfacePatchModel := new(vpcv1.ClusterNetworkInterfacePatch) + clusterNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePatchModel.Name = core.StringPtr("my-cluster-network-interface") + clusterNetworkInterfacePatchModelAsPatch, asPatchErr := clusterNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkInterfaceOptions model + updateClusterNetworkInterfaceOptionsModel := new(vpcv1.UpdateClusterNetworkInterfaceOptions) + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkInterfacePatch = clusterNetworkInterfacePatchModelAsPatch + updateClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetRegionZoneOptions model with no property values - getRegionZoneOptionsModelNew := new(vpcv1.GetRegionZoneOptions) + // Construct a second instance of the UpdateClusterNetworkInterfaceOptions model with no property values + updateClusterNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateClusterNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModelNew) + result, response, operationErr = vpcService.UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -65836,7 +73647,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetRegionZone successfully`, func() { + It(`Invoke UpdateClusterNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65845,14 +73656,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("us-south") - getRegionZoneOptionsModel.Name = core.StringPtr("us-south-1") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkInterfacePatch model + clusterNetworkInterfacePatchModel := new(vpcv1.ClusterNetworkInterfacePatch) + clusterNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePatchModel.Name = core.StringPtr("my-cluster-network-interface") + clusterNetworkInterfacePatchModelAsPatch, asPatchErr := clusterNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkInterfaceOptions model + updateClusterNetworkInterfaceOptionsModel := new(vpcv1.UpdateClusterNetworkInterfaceOptions) + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkInterfaceOptionsModel.ClusterNetworkInterfacePatch = clusterNetworkInterfacePatchModelAsPatch + updateClusterNetworkInterfaceOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -65864,28 +73684,29 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) - Operation response error`, func() { + Describe(`ListClusterNetworkSubnets(listClusterNetworkSubnetsOptions *ListClusterNetworkSubnetsOptions) - Operation response error`, func() { version := "2024-06-23" - listVirtualNetworkInterfacesPath := "/virtual_network_interfaces" + listClusterNetworkSubnetsPath := "/cluster_networks/testString/subnets" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkSubnetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListVirtualNetworkInterfaces with error: Operation response processing error`, func() { + It(`Invoke ListClusterNetworkSubnets with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65894,21 +73715,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetsOptions model + listClusterNetworkSubnetsOptionsModel := new(vpcv1.ListClusterNetworkSubnetsOptions) + listClusterNetworkSubnetsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkSubnets(listClusterNetworkSubnetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworkSubnets(listClusterNetworkSubnetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -65918,33 +73741,34 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions)`, func() { + Describe(`ListClusterNetworkSubnets(listClusterNetworkSubnetsOptions *ListClusterNetworkSubnetsOptions)`, func() { version := "2024-06-23" - listVirtualNetworkInterfacesPath := "/virtual_network_interfaces" + listClusterNetworkSubnetsPath := "/cluster_networks/testString/subnets" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkSubnetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}], "total_count": 132}`) })) }) - It(`Invoke ListVirtualNetworkInterfaces successfully with retries`, func() { + It(`Invoke ListClusterNetworkSubnets successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -65954,23 +73778,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetsOptions model + listClusterNetworkSubnetsOptionsModel := new(vpcv1.ListClusterNetworkSubnetsOptions) + listClusterNetworkSubnetsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListVirtualNetworkInterfacesWithContext(ctx, listVirtualNetworkInterfacesOptionsModel) + _, _, operationErr := vpcService.ListClusterNetworkSubnetsWithContext(ctx, listClusterNetworkSubnetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkSubnets(listClusterNetworkSubnetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -65978,7 +73804,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListVirtualNetworkInterfacesWithContext(ctx, listVirtualNetworkInterfacesOptionsModel) + _, _, operationErr = vpcService.ListClusterNetworkSubnetsWithContext(ctx, listClusterNetworkSubnetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -65992,21 +73818,22 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkSubnetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "subnets": [{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}], "total_count": 132}`) })) }) - It(`Invoke ListVirtualNetworkInterfaces successfully`, func() { + It(`Invoke ListClusterNetworkSubnets successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66016,26 +73843,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(nil) + result, response, operationErr := vpcService.ListClusterNetworkSubnets(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetsOptions model + listClusterNetworkSubnetsOptionsModel := new(vpcv1.ListClusterNetworkSubnetsOptions) + listClusterNetworkSubnetsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworkSubnets(listClusterNetworkSubnetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListVirtualNetworkInterfaces with error: Operation request error`, func() { + It(`Invoke ListClusterNetworkSubnets with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66044,18 +73873,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetsOptions model + listClusterNetworkSubnetsOptionsModel := new(vpcv1.ListClusterNetworkSubnetsOptions) + listClusterNetworkSubnetsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkSubnets(listClusterNetworkSubnetsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListClusterNetworkSubnetsOptions model with no property values + listClusterNetworkSubnetsOptionsModelNew := new(vpcv1.ListClusterNetworkSubnetsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListClusterNetworkSubnets(listClusterNetworkSubnetsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) }) @@ -66072,7 +73910,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListVirtualNetworkInterfaces successfully`, func() { + It(`Invoke ListClusterNetworkSubnets successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66081,15 +73919,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetsOptions model + listClusterNetworkSubnetsOptionsModel := new(vpcv1.ListClusterNetworkSubnetsOptions) + listClusterNetworkSubnetsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkSubnets(listClusterNetworkSubnetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -66102,8 +73942,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) - nextObject := new(vpcv1.VirtualNetworkInterfaceCollectionNext) + responseObject := new(vpcv1.ClusterNetworkSubnetCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -66112,15 +73952,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) + responseObject := new(vpcv1.ClusterNetworkSubnetCollection) value, err := responseObject.GetNextStart() Expect(err).To(BeNil()) Expect(value).To(BeNil()) }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) - nextObject := new(vpcv1.VirtualNetworkInterfaceCollectionNext) + responseObject := new(vpcv1.ClusterNetworkSubnetCollection) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -66136,7 +73976,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkSubnetsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -66144,15 +73984,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","ips":[{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","ips":[{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"protocol_state_filtering_mode":"auto","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","security_groups":[{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","id":"0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930","ip_version":"ipv4","ipv4_cidr_block":"10.0.0.0/24","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet","resource_type":"cluster_network_subnet","total_ipv4_address_count":256}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use VirtualNetworkInterfacesPager.GetNext successfully`, func() { + It(`Use ClusterNetworkSubnetsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66161,16 +74001,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listVirtualNetworkInterfacesOptionsModel := &vpcv1.ListVirtualNetworkInterfacesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), + listClusterNetworkSubnetsOptionsModel := &vpcv1.ListClusterNetworkSubnetsOptions{ + ClusterNetworkID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), } - pager, err := vpcService.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptionsModel) + pager, err := vpcService.NewClusterNetworkSubnetsPager(listClusterNetworkSubnetsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.VirtualNetworkInterface + var allResults []vpcv1.ClusterNetworkSubnet for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -66179,7 +74021,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use VirtualNetworkInterfacesPager.GetAll successfully`, func() { + It(`Use ClusterNetworkSubnetsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66188,12 +74030,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listVirtualNetworkInterfacesOptionsModel := &vpcv1.ListVirtualNetworkInterfacesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), + listClusterNetworkSubnetsOptionsModel := &vpcv1.ListClusterNetworkSubnetsOptions{ + ClusterNetworkID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), } - pager, err := vpcService.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptionsModel) + pager, err := vpcService.NewClusterNetworkSubnetsPager(listClusterNetworkSubnetsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -66204,16 +74048,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`CreateClusterNetworkSubnet(createClusterNetworkSubnetOptions *CreateClusterNetworkSubnetOptions) - Operation response error`, func() { version := "2024-06-23" - createVirtualNetworkInterfacePath := "/virtual_network_interfaces" + createClusterNetworkSubnetPath := "/cluster_networks/testString/subnets" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkSubnetPath)) Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -66222,7 +74066,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateVirtualNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke CreateClusterNetworkSubnet with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66231,48 +74075,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) - virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) - virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + // Construct an instance of the ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model + clusterNetworkSubnetPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) + clusterNetworkSubnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + clusterNetworkSubnetPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - // Construct an instance of the CreateVirtualNetworkInterfaceOptions model - createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) - createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) - createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") - createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") - createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetOptions model + createClusterNetworkSubnetOptionsModel := new(vpcv1.CreateClusterNetworkSubnetOptions) + createClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPrototype = clusterNetworkSubnetPrototypeModel + createClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkSubnet(createClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetworkSubnet(createClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -66282,16 +74104,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions)`, func() { + Describe(`CreateClusterNetworkSubnet(createClusterNetworkSubnetOptions *CreateClusterNetworkSubnetOptions)`, func() { version := "2024-06-23" - createVirtualNetworkInterfacePath := "/virtual_network_interfaces" + createClusterNetworkSubnetPath := "/cluster_networks/testString/subnets" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkSubnetPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -66318,10 +74140,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}`) })) }) - It(`Invoke CreateVirtualNetworkInterface successfully with retries`, func() { + It(`Invoke CreateClusterNetworkSubnet successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66331,50 +74153,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) - virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) - virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + // Construct an instance of the ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model + clusterNetworkSubnetPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) + clusterNetworkSubnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + clusterNetworkSubnetPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - // Construct an instance of the CreateVirtualNetworkInterfaceOptions model - createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) - createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) - createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") - createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") - createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetOptions model + createClusterNetworkSubnetOptionsModel := new(vpcv1.CreateClusterNetworkSubnetOptions) + createClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPrototype = clusterNetworkSubnetPrototypeModel + createClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.CreateVirtualNetworkInterfaceWithContext(ctx, createVirtualNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.CreateClusterNetworkSubnetWithContext(ctx, createClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkSubnet(createClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -66382,7 +74182,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateVirtualNetworkInterfaceWithContext(ctx, createVirtualNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.CreateClusterNetworkSubnetWithContext(ctx, createClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -66396,7 +74196,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkSubnetPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -66420,10 +74220,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}`) })) }) - It(`Invoke CreateVirtualNetworkInterface successfully`, func() { + It(`Invoke CreateClusterNetworkSubnet successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66433,53 +74233,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateVirtualNetworkInterface(nil) + result, response, operationErr := vpcService.CreateClusterNetworkSubnet(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) - virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) - virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + // Construct an instance of the ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model + clusterNetworkSubnetPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) + clusterNetworkSubnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + clusterNetworkSubnetPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - // Construct an instance of the CreateVirtualNetworkInterfaceOptions model - createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) - createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) - createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") - createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") - createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetOptions model + createClusterNetworkSubnetOptionsModel := new(vpcv1.CreateClusterNetworkSubnetOptions) + createClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPrototype = clusterNetworkSubnetPrototypeModel + createClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetworkSubnet(createClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateVirtualNetworkInterface with error: Operation request error`, func() { + It(`Invoke CreateClusterNetworkSubnet with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66488,47 +74266,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) - virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) - virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + // Construct an instance of the ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model + clusterNetworkSubnetPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) + clusterNetworkSubnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + clusterNetworkSubnetPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - // Construct an instance of the CreateVirtualNetworkInterfaceOptions model - createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) - createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) - createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") - createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") - createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetOptions model + createClusterNetworkSubnetOptionsModel := new(vpcv1.CreateClusterNetworkSubnetOptions) + createClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPrototype = clusterNetworkSubnetPrototypeModel + createClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkSubnet(createClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the CreateClusterNetworkSubnetOptions model with no property values + createClusterNetworkSubnetOptionsModelNew := new(vpcv1.CreateClusterNetworkSubnetOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateClusterNetworkSubnet(createClusterNetworkSubnetOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -66543,7 +74306,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateVirtualNetworkInterface successfully`, func() { + It(`Invoke CreateClusterNetworkSubnet successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66552,42 +74315,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID model - virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) - virtualNetworkInterfaceIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) - virtualNetworkInterfacePrimaryIPPrototypeModel.ID = core.StringPtr("0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + // Construct an instance of the ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model + clusterNetworkSubnetPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) + clusterNetworkSubnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + clusterNetworkSubnetPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - // Construct an instance of the CreateVirtualNetworkInterfaceOptions model - createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) - createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) - createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) - createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} - createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") - createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - createVirtualNetworkInterfaceOptionsModel.ProtocolStateFilteringMode = core.StringPtr("auto") - createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetOptions model + createClusterNetworkSubnetOptionsModel := new(vpcv1.CreateClusterNetworkSubnetOptions) + createClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPrototype = clusterNetworkSubnetPrototypeModel + createClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkSubnet(createClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -66599,25 +74340,29 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) - Operation response error`, func() { + Describe(`ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptions *ListClusterNetworkSubnetReservedIpsOptions) - Operation response error`, func() { version := "2024-06-23" - deleteVirtualNetworkInterfacesPath := "/virtual_network_interfaces/testString" + listClusterNetworkSubnetReservedIpsPath := "/cluster_networks/testString/subnets/testString/reserved_ips" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteVirtualNetworkInterfacesPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkSubnetReservedIpsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteVirtualNetworkInterfaces with error: Operation response processing error`, func() { + It(`Invoke ListClusterNetworkSubnetReservedIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66626,19 +74371,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model - deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) - deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") - deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetReservedIpsOptions model + listClusterNetworkSubnetReservedIpsOptionsModel := new(vpcv1.ListClusterNetworkSubnetReservedIpsOptions) + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetReservedIpsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -66648,30 +74398,34 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions)`, func() { + Describe(`ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptions *ListClusterNetworkSubnetReservedIpsOptions)`, func() { version := "2024-06-23" - deleteVirtualNetworkInterfacesPath := "/virtual_network_interfaces/testString" + listClusterNetworkSubnetReservedIpsPath := "/cluster_networks/testString/subnets/testString/reserved_ips" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteVirtualNetworkInterfacesPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkSubnetReservedIpsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "reserved_ips": [{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}], "total_count": 132}`) })) }) - It(`Invoke DeleteVirtualNetworkInterfaces successfully with retries`, func() { + It(`Invoke ListClusterNetworkSubnetReservedIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66681,21 +74435,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model - deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) - deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") - deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetReservedIpsOptions model + listClusterNetworkSubnetReservedIpsOptionsModel := new(vpcv1.ListClusterNetworkSubnetReservedIpsOptions) + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetReservedIpsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.DeleteVirtualNetworkInterfacesWithContext(ctx, deleteVirtualNetworkInterfacesOptionsModel) + _, _, operationErr := vpcService.ListClusterNetworkSubnetReservedIpsWithContext(ctx, listClusterNetworkSubnetReservedIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -66703,7 +74462,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteVirtualNetworkInterfacesWithContext(ctx, deleteVirtualNetworkInterfacesOptionsModel) + _, _, operationErr = vpcService.ListClusterNetworkSubnetReservedIpsWithContext(ctx, listClusterNetworkSubnetReservedIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -66717,18 +74476,22 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteVirtualNetworkInterfacesPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkSubnetReservedIpsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"my-name"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "reserved_ips": [{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}], "total_count": 132}`) })) }) - It(`Invoke DeleteVirtualNetworkInterfaces successfully`, func() { + It(`Invoke ListClusterNetworkSubnetReservedIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66738,24 +74501,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(nil) + result, response, operationErr := vpcService.ListClusterNetworkSubnetReservedIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model - deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) - deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") - deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetReservedIpsOptions model + listClusterNetworkSubnetReservedIpsOptionsModel := new(vpcv1.ListClusterNetworkSubnetReservedIpsOptions) + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetReservedIpsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteVirtualNetworkInterfaces with error: Operation validation and request error`, func() { + It(`Invoke ListClusterNetworkSubnetReservedIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66764,22 +74532,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model - deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) - deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") - deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetReservedIpsOptions model + listClusterNetworkSubnetReservedIpsOptionsModel := new(vpcv1.ListClusterNetworkSubnetReservedIpsOptions) + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetReservedIpsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeleteVirtualNetworkInterfacesOptions model with no property values - deleteVirtualNetworkInterfacesOptionsModelNew := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) + // Construct a second instance of the ListClusterNetworkSubnetReservedIpsOptions model with no property values + listClusterNetworkSubnetReservedIpsOptionsModelNew := new(vpcv1.ListClusterNetworkSubnetReservedIpsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModelNew) + result, response, operationErr = vpcService.ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -66794,10 +74567,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke DeleteVirtualNetworkInterfaces successfully`, func() { + It(`Invoke ListClusterNetworkSubnetReservedIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66806,13 +74579,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model - deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) - deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") - deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListClusterNetworkSubnetReservedIpsOptions model + listClusterNetworkSubnetReservedIpsOptionsModel := new(vpcv1.ListClusterNetworkSubnetReservedIpsOptions) + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listClusterNetworkSubnetReservedIpsOptionsModel.Name = core.StringPtr("my-name") + listClusterNetworkSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listClusterNetworkSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -66823,26 +74601,135 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ClusterNetworkSubnetReservedIPCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.ClusterNetworkSubnetReservedIPCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.ClusterNetworkSubnetReservedIPCollection) + nextObject := new(vpcv1.PageLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listClusterNetworkSubnetReservedIpsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"reserved_ips":[{"address":"10.1.0.6","auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","name":"my-cluster-network-subnet-reserved-ip","owner":"user","resource_type":"cluster_network_subnet_reserved_ip","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","id":"0717-ffc092f7-5d02-4b93-ab69-26860529b9fb","name":"my-cluster-network-interface","resource_type":"cluster_network_interface"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use ClusterNetworkSubnetReservedIpsPager.GetNext successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listClusterNetworkSubnetReservedIpsOptionsModel := &vpcv1.ListClusterNetworkSubnetReservedIpsOptions{ + ClusterNetworkID: core.StringPtr("testString"), + ClusterNetworkSubnetID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewClusterNetworkSubnetReservedIpsPager(listClusterNetworkSubnetReservedIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ClusterNetworkSubnetReservedIP + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ClusterNetworkSubnetReservedIpsPager.GetAll successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + listClusterNetworkSubnetReservedIpsOptionsModel := &vpcv1.ListClusterNetworkSubnetReservedIpsOptions{ + ClusterNetworkID: core.StringPtr("testString"), + ClusterNetworkSubnetID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("my-name"), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewClusterNetworkSubnetReservedIpsPager(listClusterNetworkSubnetReservedIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptions *CreateClusterNetworkSubnetReservedIPOptions) - Operation response error`, func() { version := "2024-06-23" - getVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" + createClusterNetworkSubnetReservedIPPath := "/cluster_networks/testString/subnets/testString/reserved_ips" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetVirtualNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke CreateClusterNetworkSubnetReservedIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66851,19 +74738,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetReservedIPOptions model + createClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.CreateClusterNetworkSubnetReservedIPOptions) + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createClusterNetworkSubnetReservedIPOptionsModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + createClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -66873,17 +74763,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions)`, func() { + Describe(`CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptions *CreateClusterNetworkSubnetReservedIPOptions)`, func() { version := "2024-06-23" - getVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" + createClusterNetworkSubnetReservedIPPath := "/cluster_networks/testString/subnets/testString/reserved_ips" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -66892,11 +74798,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}`) })) }) - It(`Invoke GetVirtualNetworkInterface successfully with retries`, func() { + It(`Invoke CreateClusterNetworkSubnetReservedIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66906,21 +74812,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetReservedIPOptions model + createClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.CreateClusterNetworkSubnetReservedIPOptions) + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createClusterNetworkSubnetReservedIPOptionsModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + createClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetVirtualNetworkInterfaceWithContext(ctx, getVirtualNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.CreateClusterNetworkSubnetReservedIPWithContext(ctx, createClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -66928,7 +74837,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetVirtualNetworkInterfaceWithContext(ctx, getVirtualNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.CreateClusterNetworkSubnetReservedIPWithContext(ctx, createClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -66942,18 +74851,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}`) })) }) - It(`Invoke GetVirtualNetworkInterface successfully`, func() { + It(`Invoke CreateClusterNetworkSubnetReservedIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66963,24 +74888,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetVirtualNetworkInterface(nil) + result, response, operationErr := vpcService.CreateClusterNetworkSubnetReservedIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetReservedIPOptions model + createClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.CreateClusterNetworkSubnetReservedIPOptions) + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createClusterNetworkSubnetReservedIPOptionsModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + createClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetVirtualNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke CreateClusterNetworkSubnetReservedIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -66989,22 +74917,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetReservedIPOptions model + createClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.CreateClusterNetworkSubnetReservedIPOptions) + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createClusterNetworkSubnetReservedIPOptionsModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + createClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetVirtualNetworkInterfaceOptions model with no property values - getVirtualNetworkInterfaceOptionsModelNew := new(vpcv1.GetVirtualNetworkInterfaceOptions) + // Construct a second instance of the CreateClusterNetworkSubnetReservedIPOptions model with no property values + createClusterNetworkSubnetReservedIPOptionsModelNew := new(vpcv1.CreateClusterNetworkSubnetReservedIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -67019,10 +74950,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetVirtualNetworkInterface successfully`, func() { + It(`Invoke CreateClusterNetworkSubnetReservedIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67031,13 +74962,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateClusterNetworkSubnetReservedIPOptions model + createClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.CreateClusterNetworkSubnetReservedIPOptions) + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + createClusterNetworkSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createClusterNetworkSubnetReservedIPOptionsModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + createClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -67049,25 +74983,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptions *DeleteClusterNetworkSubnetReservedIPOptions) - Operation response error`, func() { version := "2024-06-23" - updateVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" + deleteClusterNetworkSubnetReservedIPPath := "/cluster_networks/testString/subnets/testString/reserved_ips/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateVirtualNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke DeleteClusterNetworkSubnetReservedIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67076,30 +75012,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetReservedIPOptions model + deleteClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetReservedIPOptions) + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -67109,34 +75037,20 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions)`, func() { - version := "2024-06-23" - updateVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Describe(`DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptions *DeleteClusterNetworkSubnetReservedIPOptions)`, func() { + version := "2024-06-23" + deleteClusterNetworkSubnetReservedIPPath := "/cluster_networks/testString/subnets/testString/reserved_ips/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -67144,11 +75058,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}`) })) }) - It(`Invoke UpdateVirtualNetworkInterface successfully with retries`, func() { + It(`Invoke DeleteClusterNetworkSubnetReservedIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67158,32 +75072,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetReservedIPOptions model + deleteClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetReservedIPOptions) + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.UpdateVirtualNetworkInterfaceWithContext(ctx, updateVirtualNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.DeleteClusterNetworkSubnetReservedIPWithContext(ctx, deleteClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -67191,7 +75097,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateVirtualNetworkInterfaceWithContext(ctx, updateVirtualNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.DeleteClusterNetworkSubnetReservedIPWithContext(ctx, deleteClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -67205,34 +75111,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "protocol_state_filtering_mode": "auto", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}`) })) }) - It(`Invoke UpdateVirtualNetworkInterface successfully`, func() { + It(`Invoke DeleteClusterNetworkSubnetReservedIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67242,35 +75134,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(nil) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnetReservedIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetReservedIPOptions model + deleteClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetReservedIPOptions) + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateVirtualNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke DeleteClusterNetworkSubnetReservedIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67279,33 +75163,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetReservedIPOptions model + deleteClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetReservedIPOptions) + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateVirtualNetworkInterfaceOptions model with no property values - updateVirtualNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + // Construct a second instance of the DeleteClusterNetworkSubnetReservedIPOptions model with no property values + deleteClusterNetworkSubnetReservedIPOptionsModelNew := new(vpcv1.DeleteClusterNetworkSubnetReservedIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -67320,10 +75196,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke UpdateVirtualNetworkInterface successfully`, func() { + It(`Invoke DeleteClusterNetworkSubnetReservedIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67332,24 +75208,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModel.ProtocolStateFilteringMode = core.StringPtr("auto") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetReservedIPOptions model + deleteClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetReservedIPOptions) + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -67361,28 +75229,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { + Describe(`GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptions *GetClusterNetworkSubnetReservedIPOptions) - Operation response error`, func() { version := "2024-06-23" - listNetworkInterfaceFloatingIpsPath := "/virtual_network_interfaces/testString/floating_ips" + getClusterNetworkSubnetReservedIPPath := "/cluster_networks/testString/subnets/testString/reserved_ips/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkSubnetReservedIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { + It(`Invoke GetClusterNetworkSubnetReservedIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67391,22 +75256,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model - listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) - listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetReservedIPOptions model + getClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.GetClusterNetworkSubnetReservedIPOptions) + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -67416,33 +75280,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions)`, func() { + Describe(`GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptions *GetClusterNetworkSubnetReservedIPOptions)`, func() { version := "2024-06-23" - listNetworkInterfaceFloatingIpsPath := "/virtual_network_interfaces/testString/floating_ips" + getClusterNetworkSubnetReservedIPPath := "/cluster_networks/testString/subnets/testString/reserved_ips/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkSubnetReservedIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}`) })) }) - It(`Invoke ListNetworkInterfaceFloatingIps successfully with retries`, func() { + It(`Invoke GetClusterNetworkSubnetReservedIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67452,24 +75313,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model - listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) - listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetReservedIPOptions model + getClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.GetClusterNetworkSubnetReservedIPOptions) + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListNetworkInterfaceFloatingIpsWithContext(ctx, listNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr := vpcService.GetClusterNetworkSubnetReservedIPWithContext(ctx, getClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -67477,7 +75337,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListNetworkInterfaceFloatingIpsWithContext(ctx, listNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr = vpcService.GetClusterNetworkSubnetReservedIPWithContext(ctx, getClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -67491,21 +75351,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkSubnetReservedIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}`) })) }) - It(`Invoke ListNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke GetClusterNetworkSubnetReservedIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67515,27 +75372,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(nil) + result, response, operationErr := vpcService.GetClusterNetworkSubnetReservedIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model - listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) - listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetReservedIPOptions model + getClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.GetClusterNetworkSubnetReservedIPOptions) + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { + It(`Invoke GetClusterNetworkSubnetReservedIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67544,25 +75400,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model - listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) - listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetReservedIPOptions model + getClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.GetClusterNetworkSubnetReservedIPOptions) + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListNetworkInterfaceFloatingIpsOptions model with no property values - listNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + // Construct a second instance of the GetClusterNetworkSubnetReservedIPOptions model with no property values + getClusterNetworkSubnetReservedIPOptionsModelNew := new(vpcv1.GetClusterNetworkSubnetReservedIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModelNew) + result, response, operationErr = vpcService.GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -67580,7 +75435,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke GetClusterNetworkSubnetReservedIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67589,16 +75444,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model - listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) - listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetReservedIPOptions model + getClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.GetClusterNetworkSubnetReservedIPOptions) + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -67609,59 +75463,28 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContext) - nextObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContextNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContext) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContext) - nextObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContextNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptions *UpdateClusterNetworkSubnetReservedIPOptions) - Operation response error`, func() { + version := "2024-06-23" + updateClusterNetworkSubnetReservedIPPath := "/cluster_networks/testString/subnets/testString/reserved_ips/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}]}`) - } else { - res.WriteHeader(400) - } + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Use NetworkInterfaceFloatingIpsPager.GetNext successfully`, func() { + It(`Invoke UpdateClusterNetworkSubnetReservedIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67670,26 +75493,81 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listNetworkInterfaceFloatingIpsOptionsModel := &vpcv1.ListNetworkInterfaceFloatingIpsOptions{ - VirtualNetworkInterfaceID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } + // Construct an instance of the ClusterNetworkSubnetReservedIPPatch model + clusterNetworkSubnetReservedIPPatchModel := new(vpcv1.ClusterNetworkSubnetReservedIPPatch) + clusterNetworkSubnetReservedIPPatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkSubnetReservedIPPatchModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + clusterNetworkSubnetReservedIPPatchModelAsPatch, asPatchErr := clusterNetworkSubnetReservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - pager, err := vpcService.NewNetworkInterfaceFloatingIpsPager(listNetworkInterfaceFloatingIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the UpdateClusterNetworkSubnetReservedIPOptions model + updateClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetReservedIPOptions) + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetReservedIPPatch = clusterNetworkSubnetReservedIPPatchModelAsPatch + updateClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - var allResults []vpcv1.FloatingIPReference - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) - It(`Use NetworkInterfaceFloatingIpsPager.GetAll successfully`, func() { + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptions *UpdateClusterNetworkSubnetReservedIPOptions)`, func() { + version := "2024-06-23" + updateClusterNetworkSubnetReservedIPPath := "/cluster_networks/testString/subnets/testString/reserved_ips/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}`) + })) + }) + It(`Invoke UpdateClusterNetworkSubnetReservedIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67697,42 +75575,85 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) - listNetworkInterfaceFloatingIpsOptionsModel := &vpcv1.ListNetworkInterfaceFloatingIpsOptions{ - VirtualNetworkInterfaceID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } + // Construct an instance of the ClusterNetworkSubnetReservedIPPatch model + clusterNetworkSubnetReservedIPPatchModel := new(vpcv1.ClusterNetworkSubnetReservedIPPatch) + clusterNetworkSubnetReservedIPPatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkSubnetReservedIPPatchModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + clusterNetworkSubnetReservedIPPatchModelAsPatch, asPatchErr := clusterNetworkSubnetReservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - pager, err := vpcService.NewNetworkInterfaceFloatingIpsPager(listNetworkInterfaceFloatingIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the UpdateClusterNetworkSubnetReservedIPOptions model + updateClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetReservedIPOptions) + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetReservedIPPatch = clusterNetworkSubnetReservedIPPatchModelAsPatch + updateClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.UpdateClusterNetworkSubnetReservedIPWithContext(ctx, updateClusterNetworkSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.UpdateClusterNetworkSubnetReservedIPWithContext(ctx, updateClusterNetworkSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() }) }) - }) - Describe(`RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions)`, func() { - version := "2024-06-23" - removeNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(removeNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkSubnetReservedIPPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"address": "10.1.0.6", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet-reserved-ip", "owner": "user", "resource_type": "cluster_network_subnet_reserved_ip", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "id": "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb", "name": "my-cluster-network-interface", "resource_type": "cluster_network_interface"}}`) })) }) - It(`Invoke RemoveNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke UpdateClusterNetworkSubnetReservedIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67742,22 +75663,35 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.RemoveNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.UpdateClusterNetworkSubnetReservedIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the RemoveNetworkInterfaceFloatingIPOptions model - removeNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) - removeNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - removeNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkSubnetReservedIPPatch model + clusterNetworkSubnetReservedIPPatchModel := new(vpcv1.ClusterNetworkSubnetReservedIPPatch) + clusterNetworkSubnetReservedIPPatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkSubnetReservedIPPatchModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + clusterNetworkSubnetReservedIPPatchModelAsPatch, asPatchErr := clusterNetworkSubnetReservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkSubnetReservedIPOptions model + updateClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetReservedIPOptions) + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetReservedIPPatch = clusterNetworkSubnetReservedIPPatchModelAsPatch + updateClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke RemoveNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke UpdateClusterNetworkSubnetReservedIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67766,49 +75700,109 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the RemoveNetworkInterfaceFloatingIPOptions model - removeNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) - removeNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - removeNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkSubnetReservedIPPatch model + clusterNetworkSubnetReservedIPPatchModel := new(vpcv1.ClusterNetworkSubnetReservedIPPatch) + clusterNetworkSubnetReservedIPPatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkSubnetReservedIPPatchModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + clusterNetworkSubnetReservedIPPatchModelAsPatch, asPatchErr := clusterNetworkSubnetReservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkSubnetReservedIPOptions model + updateClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetReservedIPOptions) + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetReservedIPPatch = clusterNetworkSubnetReservedIPPatchModelAsPatch + updateClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the RemoveNetworkInterfaceFloatingIPOptions model with no property values - removeNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateClusterNetworkSubnetReservedIPOptions model with no property values + updateClusterNetworkSubnetReservedIPOptionsModelNew := new(vpcv1.UpdateClusterNetworkSubnetReservedIPOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateClusterNetworkSubnetReservedIP successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ClusterNetworkSubnetReservedIPPatch model + clusterNetworkSubnetReservedIPPatchModel := new(vpcv1.ClusterNetworkSubnetReservedIPPatch) + clusterNetworkSubnetReservedIPPatchModel.AutoDelete = core.BoolPtr(false) + clusterNetworkSubnetReservedIPPatchModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + clusterNetworkSubnetReservedIPPatchModelAsPatch, asPatchErr := clusterNetworkSubnetReservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkSubnetReservedIPOptions model + updateClusterNetworkSubnetReservedIPOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetReservedIPOptions) + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetReservedIPPatch = clusterNetworkSubnetReservedIPPatchModelAsPatch + updateClusterNetworkSubnetReservedIPOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptions *DeleteClusterNetworkSubnetOptions) - Operation response error`, func() { version := "2024-06-23" - getNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" + deleteClusterNetworkSubnetPath := "/cluster_networks/testString/subnets/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke DeleteClusterNetworkSubnet with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67817,20 +75811,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model - getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) - getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetOptions model + deleteClusterNetworkSubnetOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetOptions) + deleteClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -67840,18 +75835,20 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptions *DeleteClusterNetworkSubnetOptions)`, func() { version := "2024-06-23" - getNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" + deleteClusterNetworkSubnetPath := "/cluster_networks/testString/subnets/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -67859,11 +75856,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}`) })) }) - It(`Invoke GetNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke DeleteClusterNetworkSubnet successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67873,22 +75870,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model - getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) - getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetOptions model + deleteClusterNetworkSubnetOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetOptions) + deleteClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetNetworkInterfaceFloatingIPWithContext(ctx, getNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.DeleteClusterNetworkSubnetWithContext(ctx, deleteClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -67896,7 +75894,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetNetworkInterfaceFloatingIPWithContext(ctx, getNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.DeleteClusterNetworkSubnetWithContext(ctx, deleteClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -67910,18 +75908,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}`) })) }) - It(`Invoke GetNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke DeleteClusterNetworkSubnet successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67931,25 +75931,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnet(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model - getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) - getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetOptions model + deleteClusterNetworkSubnetOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetOptions) + deleteClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke DeleteClusterNetworkSubnet with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -67958,23 +75959,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model - getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) - getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetOptions model + deleteClusterNetworkSubnetOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetOptions) + deleteClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetNetworkInterfaceFloatingIPOptions model with no property values - getNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the DeleteClusterNetworkSubnetOptions model with no property values + deleteClusterNetworkSubnetOptionsModelNew := new(vpcv1.DeleteClusterNetworkSubnetOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -67989,10 +75991,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke GetNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke DeleteClusterNetworkSubnet successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68001,14 +76003,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model - getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) - getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkSubnetOptions model + deleteClusterNetworkSubnetOptionsModel := new(vpcv1.DeleteClusterNetworkSubnetOptions) + deleteClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -68020,17 +76023,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`GetClusterNetworkSubnet(getClusterNetworkSubnetOptions *GetClusterNetworkSubnetOptions) - Operation response error`, func() { version := "2024-06-23" - addNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" + getClusterNetworkSubnetPath := "/cluster_networks/testString/subnets/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -68038,7 +76041,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke AddNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke GetClusterNetworkSubnet with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68047,20 +76050,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model - addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) - addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetOptions model + getClusterNetworkSubnetOptionsModel := new(vpcv1.GetClusterNetworkSubnetOptions) + getClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkSubnet(getClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.GetClusterNetworkSubnet(getClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -68070,17 +76073,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`GetClusterNetworkSubnet(getClusterNetworkSubnetOptions *GetClusterNetworkSubnetOptions)`, func() { version := "2024-06-23" - addNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/testString" + getClusterNetworkSubnetPath := "/cluster_networks/testString/subnets/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -68090,10 +76093,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}`) + fmt.Fprintf(res, "%s", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}`) })) }) - It(`Invoke AddNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke GetClusterNetworkSubnet successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68103,22 +76106,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model - addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) - addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - + // Construct an instance of the GetClusterNetworkSubnetOptions model + getClusterNetworkSubnetOptionsModel := new(vpcv1.GetClusterNetworkSubnetOptions) + getClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.AddNetworkInterfaceFloatingIPWithContext(ctx, addNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.GetClusterNetworkSubnetWithContext(ctx, getClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkSubnet(getClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -68126,7 +76129,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.AddNetworkInterfaceFloatingIPWithContext(ctx, addNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.GetClusterNetworkSubnetWithContext(ctx, getClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -68140,18 +76143,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}`) + fmt.Fprintf(res, "%s", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}`) })) }) - It(`Invoke AddNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke GetClusterNetworkSubnet successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68161,25 +76164,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.GetClusterNetworkSubnet(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model - addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) - addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetOptions model + getClusterNetworkSubnetOptionsModel := new(vpcv1.GetClusterNetworkSubnetOptions) + getClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.GetClusterNetworkSubnet(getClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke AddNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke GetClusterNetworkSubnet with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68188,23 +76191,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model - addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) - addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetOptions model + getClusterNetworkSubnetOptionsModel := new(vpcv1.GetClusterNetworkSubnetOptions) + getClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkSubnet(getClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the AddNetworkInterfaceFloatingIPOptions model with no property values - addNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the GetClusterNetworkSubnetOptions model with no property values + getClusterNetworkSubnetOptionsModelNew := new(vpcv1.GetClusterNetworkSubnetOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.GetClusterNetworkSubnet(getClusterNetworkSubnetOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -68222,7 +76225,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke AddNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke GetClusterNetworkSubnet successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68231,14 +76234,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model - addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) - addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkSubnetOptions model + getClusterNetworkSubnetOptionsModel := new(vpcv1.GetClusterNetworkSubnetOptions) + getClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetClusterNetworkSubnet(getClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -68250,28 +76253,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) - Operation response error`, func() { + Describe(`UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptions *UpdateClusterNetworkSubnetOptions) - Operation response error`, func() { version := "2024-06-23" - listVirtualNetworkInterfaceIpsPath := "/virtual_network_interfaces/testString/ips" + updateClusterNetworkSubnetPath := "/cluster_networks/testString/subnets/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListVirtualNetworkInterfaceIps with error: Operation response processing error`, func() { + It(`Invoke UpdateClusterNetworkSubnet with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68280,22 +76282,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model - listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) - listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") - listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkSubnetPatch model + clusterNetworkSubnetPatchModel := new(vpcv1.ClusterNetworkSubnetPatch) + clusterNetworkSubnetPatchModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPatchModelAsPatch, asPatchErr := clusterNetworkSubnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkSubnetOptions model + updateClusterNetworkSubnetOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetOptions) + updateClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPatch = clusterNetworkSubnetPatchModelAsPatch + updateClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -68305,33 +76313,48 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions)`, func() { + Describe(`UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptions *UpdateClusterNetworkSubnetOptions)`, func() { version := "2024-06-23" - listVirtualNetworkInterfaceIpsPath := "/virtual_network_interfaces/testString/ips" + updateClusterNetworkSubnetPath := "/cluster_networks/testString/subnets/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}`) })) }) - It(`Invoke ListVirtualNetworkInterfaceIps successfully with retries`, func() { + It(`Invoke UpdateClusterNetworkSubnet successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68341,24 +76364,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model - listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) - listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") - listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkSubnetPatch model + clusterNetworkSubnetPatchModel := new(vpcv1.ClusterNetworkSubnetPatch) + clusterNetworkSubnetPatchModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPatchModelAsPatch, asPatchErr := clusterNetworkSubnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkSubnetOptions model + updateClusterNetworkSubnetOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetOptions) + updateClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPatch = clusterNetworkSubnetPatchModelAsPatch + updateClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.ListVirtualNetworkInterfaceIpsWithContext(ctx, listVirtualNetworkInterfaceIpsOptionsModel) + _, _, operationErr := vpcService.UpdateClusterNetworkSubnetWithContext(ctx, updateClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -68366,7 +76395,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListVirtualNetworkInterfaceIpsWithContext(ctx, listVirtualNetworkInterfaceIpsOptionsModel) + _, _, operationErr = vpcService.UpdateClusterNetworkSubnetWithContext(ctx, updateClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -68380,21 +76409,36 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkSubnetPath)) + Expect(req.Method).To(Equal("PATCH")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "id": "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930", "ip_version": "ipv4", "ipv4_cidr_block": "10.0.0.0/24", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network-subnet", "resource_type": "cluster_network_subnet", "total_ipv4_address_count": 256}`) })) }) - It(`Invoke ListVirtualNetworkInterfaceIps successfully`, func() { + It(`Invoke UpdateClusterNetworkSubnet successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68404,27 +76448,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(nil) + result, response, operationErr := vpcService.UpdateClusterNetworkSubnet(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model - listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) - listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") - listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkSubnetPatch model + clusterNetworkSubnetPatchModel := new(vpcv1.ClusterNetworkSubnetPatch) + clusterNetworkSubnetPatchModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPatchModelAsPatch, asPatchErr := clusterNetworkSubnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkSubnetOptions model + updateClusterNetworkSubnetOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetOptions) + updateClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPatch = clusterNetworkSubnetPatchModelAsPatch + updateClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListVirtualNetworkInterfaceIps with error: Operation validation and request error`, func() { + It(`Invoke UpdateClusterNetworkSubnet with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68433,25 +76483,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model - listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) - listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") - listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkSubnetPatch model + clusterNetworkSubnetPatchModel := new(vpcv1.ClusterNetworkSubnetPatch) + clusterNetworkSubnetPatchModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPatchModelAsPatch, asPatchErr := clusterNetworkSubnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkSubnetOptions model + updateClusterNetworkSubnetOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetOptions) + updateClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPatch = clusterNetworkSubnetPatchModelAsPatch + updateClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListVirtualNetworkInterfaceIpsOptions model with no property values - listVirtualNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + // Construct a second instance of the UpdateClusterNetworkSubnetOptions model with no property values + updateClusterNetworkSubnetOptionsModelNew := new(vpcv1.UpdateClusterNetworkSubnetOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModelNew) + result, response, operationErr = vpcService.UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -68469,7 +76525,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListVirtualNetworkInterfaceIps successfully`, func() { + It(`Invoke UpdateClusterNetworkSubnet successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68478,16 +76534,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model - listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) - listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") - listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkSubnetPatch model + clusterNetworkSubnetPatchModel := new(vpcv1.ClusterNetworkSubnetPatch) + clusterNetworkSubnetPatchModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPatchModelAsPatch, asPatchErr := clusterNetworkSubnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkSubnetOptions model + updateClusterNetworkSubnetOptionsModel := new(vpcv1.UpdateClusterNetworkSubnetOptions) + updateClusterNetworkSubnetOptionsModel.ClusterNetworkID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPatch = clusterNetworkSubnetPatchModelAsPatch + updateClusterNetworkSubnetOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -68498,59 +76560,28 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) - nextObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContextNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) - nextObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContextNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`DeleteClusterNetwork(deleteClusterNetworkOptions *DeleteClusterNetworkOptions) - Operation response error`, func() { + version := "2024-06-23" + deleteClusterNetworkPath := "/cluster_networks/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"ips":[{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"ips":[{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}]}`) - } else { - res.WriteHeader(400) - } + res.WriteHeader(202) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Use VirtualNetworkInterfaceIpsPager.GetNext successfully`, func() { + It(`Invoke DeleteClusterNetwork with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68559,26 +76590,55 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listVirtualNetworkInterfaceIpsOptionsModel := &vpcv1.ListVirtualNetworkInterfaceIpsOptions{ - VirtualNetworkInterfaceID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } + // Construct an instance of the DeleteClusterNetworkOptions model + deleteClusterNetworkOptionsModel := new(vpcv1.DeleteClusterNetworkOptions) + deleteClusterNetworkOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.DeleteClusterNetwork(deleteClusterNetworkOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - pager, err := vpcService.NewVirtualNetworkInterfaceIpsPager(listVirtualNetworkInterfaceIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.DeleteClusterNetwork(deleteClusterNetworkOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteClusterNetwork(deleteClusterNetworkOptions *DeleteClusterNetworkOptions)`, func() { + version := "2024-06-23" + deleteClusterNetworkPath := "/cluster_networks/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - var allResults []vpcv1.ReservedIPReference - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) }) - It(`Use VirtualNetworkInterfaceIpsPager.GetAll successfully`, func() { + It(`Invoke DeleteClusterNetwork successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68586,42 +76646,59 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) - listVirtualNetworkInterfaceIpsOptionsModel := &vpcv1.ListVirtualNetworkInterfaceIpsOptions{ - VirtualNetworkInterfaceID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } + // Construct an instance of the DeleteClusterNetworkOptions model + deleteClusterNetworkOptionsModel := new(vpcv1.DeleteClusterNetworkOptions) + deleteClusterNetworkOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - pager, err := vpcService.NewVirtualNetworkInterfaceIpsPager(listVirtualNetworkInterfaceIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.DeleteClusterNetworkWithContext(ctx, deleteClusterNetworkOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.DeleteClusterNetwork(deleteClusterNetworkOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.DeleteClusterNetworkWithContext(ctx, deleteClusterNetworkOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() }) }) - }) - Describe(`RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions)`, func() { - version := "2024-06-23" - removeVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(removeVirtualNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteClusterNetworkPath)) Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke RemoveVirtualNetworkInterfaceIP successfully`, func() { + It(`Invoke DeleteClusterNetwork successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68631,22 +76708,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.RemoveVirtualNetworkInterfaceIP(nil) + result, response, operationErr := vpcService.DeleteClusterNetwork(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the RemoveVirtualNetworkInterfaceIPOptions model - removeVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) - removeVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - removeVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - removeVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkOptions model + deleteClusterNetworkOptionsModel := new(vpcv1.DeleteClusterNetworkOptions) + deleteClusterNetworkOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.DeleteClusterNetwork(deleteClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke RemoveVirtualNetworkInterfaceIP with error: Operation validation and request error`, func() { + It(`Invoke DeleteClusterNetwork with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68655,40 +76735,78 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the RemoveVirtualNetworkInterfaceIPOptions model - removeVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) - removeVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - removeVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - removeVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteClusterNetworkOptions model + deleteClusterNetworkOptionsModel := new(vpcv1.DeleteClusterNetworkOptions) + deleteClusterNetworkOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := vpcService.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.DeleteClusterNetwork(deleteClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the RemoveVirtualNetworkInterfaceIPOptions model with no property values - removeVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the DeleteClusterNetworkOptions model with no property values + deleteClusterNetworkOptionsModelNew := new(vpcv1.DeleteClusterNetworkOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModelNew) + result, response, operationErr = vpcService.DeleteClusterNetwork(deleteClusterNetworkOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteClusterNetwork successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteClusterNetworkOptions model + deleteClusterNetworkOptionsModel := new(vpcv1.DeleteClusterNetworkOptions) + deleteClusterNetworkOptionsModel.ID = core.StringPtr("testString") + deleteClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.DeleteClusterNetwork(deleteClusterNetworkOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) - Operation response error`, func() { + Describe(`GetClusterNetwork(getClusterNetworkOptions *GetClusterNetworkOptions) - Operation response error`, func() { version := "2024-06-23" - getVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" + getClusterNetworkPath := "/cluster_networks/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -68697,7 +76815,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetVirtualNetworkInterfaceIP with error: Operation response processing error`, func() { + It(`Invoke GetClusterNetwork with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68706,20 +76824,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model - getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) - getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkOptions model + getClusterNetworkOptionsModel := new(vpcv1.GetClusterNetworkOptions) + getClusterNetworkOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.GetClusterNetwork(getClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.GetClusterNetwork(getClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -68729,16 +76846,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions)`, func() { + Describe(`GetClusterNetwork(getClusterNetworkOptions *GetClusterNetworkOptions)`, func() { version := "2024-06-23" - getVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" + getClusterNetworkPath := "/cluster_networks/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -68749,10 +76866,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetVirtualNetworkInterfaceIP successfully with retries`, func() { + It(`Invoke GetClusterNetwork successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68762,22 +76879,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model - getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) - getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkOptions model + getClusterNetworkOptionsModel := new(vpcv1.GetClusterNetworkOptions) + getClusterNetworkOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.GetVirtualNetworkInterfaceIPWithContext(ctx, getVirtualNetworkInterfaceIPOptionsModel) + _, _, operationErr := vpcService.GetClusterNetworkWithContext(ctx, getClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.GetClusterNetwork(getClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -68785,7 +76901,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetVirtualNetworkInterfaceIPWithContext(ctx, getVirtualNetworkInterfaceIPOptionsModel) + _, _, operationErr = vpcService.GetClusterNetworkWithContext(ctx, getClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -68799,7 +76915,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterNetworkPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) @@ -68807,10 +76923,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetVirtualNetworkInterfaceIP successfully`, func() { + It(`Invoke GetClusterNetwork successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68820,25 +76936,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(nil) + result, response, operationErr := vpcService.GetClusterNetwork(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model - getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) - getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkOptions model + getClusterNetworkOptionsModel := new(vpcv1.GetClusterNetworkOptions) + getClusterNetworkOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.GetClusterNetwork(getClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetVirtualNetworkInterfaceIP with error: Operation validation and request error`, func() { + It(`Invoke GetClusterNetwork with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68847,23 +76962,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model - getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) - getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkOptions model + getClusterNetworkOptionsModel := new(vpcv1.GetClusterNetworkOptions) + getClusterNetworkOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.GetClusterNetwork(getClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetVirtualNetworkInterfaceIPOptions model with no property values - getVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + // Construct a second instance of the GetClusterNetworkOptions model with no property values + getClusterNetworkOptionsModelNew := new(vpcv1.GetClusterNetworkOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModelNew) + result, response, operationErr = vpcService.GetClusterNetwork(getClusterNetworkOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -68881,7 +76995,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetVirtualNetworkInterfaceIP successfully`, func() { + It(`Invoke GetClusterNetwork successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68890,14 +77004,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model - getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) - getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterNetworkOptions model + getClusterNetworkOptionsModel := new(vpcv1.GetClusterNetworkOptions) + getClusterNetworkOptionsModel.ID = core.StringPtr("testString") + getClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.GetClusterNetwork(getClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -68909,17 +77022,19 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) - Operation response error`, func() { + Describe(`UpdateClusterNetwork(updateClusterNetworkOptions *UpdateClusterNetworkOptions) - Operation response error`, func() { version := "2024-06-23" - addVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" + updateClusterNetworkPath := "/cluster_networks/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -68927,7 +77042,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke AddVirtualNetworkInterfaceIP with error: Operation response processing error`, func() { + It(`Invoke UpdateClusterNetwork with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68936,20 +77051,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model - addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) - addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkPatch model + clusterNetworkPatchModel := new(vpcv1.ClusterNetworkPatch) + clusterNetworkPatchModel.Name = core.StringPtr("my-cluster-network") + clusterNetworkPatchModelAsPatch, asPatchErr := clusterNetworkPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkOptions model + updateClusterNetworkOptionsModel := new(vpcv1.UpdateClusterNetworkOptions) + updateClusterNetworkOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkOptionsModel.ClusterNetworkPatch = clusterNetworkPatchModelAsPatch + updateClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetwork(updateClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.UpdateClusterNetwork(updateClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -68959,18 +77081,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions)`, func() { + Describe(`UpdateClusterNetwork(updateClusterNetworkOptions *UpdateClusterNetworkOptions)`, func() { version := "2024-06-23" - addVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/testString" + updateClusterNetworkPath := "/cluster_networks/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -68979,10 +77119,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke AddVirtualNetworkInterfaceIP successfully with retries`, func() { + It(`Invoke UpdateClusterNetwork successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -68992,22 +77132,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model - addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) - addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkPatch model + clusterNetworkPatchModel := new(vpcv1.ClusterNetworkPatch) + clusterNetworkPatchModel.Name = core.StringPtr("my-cluster-network") + clusterNetworkPatchModelAsPatch, asPatchErr := clusterNetworkPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkOptions model + updateClusterNetworkOptionsModel := new(vpcv1.UpdateClusterNetworkOptions) + updateClusterNetworkOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkOptionsModel.ClusterNetworkPatch = clusterNetworkPatchModelAsPatch + updateClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := vpcService.AddVirtualNetworkInterfaceIPWithContext(ctx, addVirtualNetworkInterfaceIPOptionsModel) + _, _, operationErr := vpcService.UpdateClusterNetworkWithContext(ctx, updateClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetwork(updateClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -69015,7 +77162,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.AddVirtualNetworkInterfaceIPWithContext(ctx, addVirtualNetworkInterfaceIPOptionsModel) + _, _, operationErr = vpcService.UpdateClusterNetworkWithContext(ctx, updateClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -69029,18 +77176,36 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(updateClusterNetworkPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:0717-da0df18c-7598-4633-a648-fdaac28a5573", "href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573", "id": "0717-da0df18c-7598-4633-a648-fdaac28a5573", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-cluster-network", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100", "name": "h100", "resource_type": "cluster_network_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "cluster_network", "subnet_prefixes": [{"allocation_policy": "auto", "cidr": "10.0.0.0/24"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke AddVirtualNetworkInterfaceIP successfully`, func() { + It(`Invoke UpdateClusterNetwork successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -69050,25 +77215,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(nil) + result, response, operationErr := vpcService.UpdateClusterNetwork(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model - addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) - addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkPatch model + clusterNetworkPatchModel := new(vpcv1.ClusterNetworkPatch) + clusterNetworkPatchModel.Name = core.StringPtr("my-cluster-network") + clusterNetworkPatchModelAsPatch, asPatchErr := clusterNetworkPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkOptions model + updateClusterNetworkOptionsModel := new(vpcv1.UpdateClusterNetworkOptions) + updateClusterNetworkOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkOptionsModel.ClusterNetworkPatch = clusterNetworkPatchModelAsPatch + updateClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.UpdateClusterNetwork(updateClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke AddVirtualNetworkInterfaceIP with error: Operation validation and request error`, func() { + It(`Invoke UpdateClusterNetwork with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -69077,23 +77249,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model - addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) - addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkPatch model + clusterNetworkPatchModel := new(vpcv1.ClusterNetworkPatch) + clusterNetworkPatchModel.Name = core.StringPtr("my-cluster-network") + clusterNetworkPatchModelAsPatch, asPatchErr := clusterNetworkPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkOptions model + updateClusterNetworkOptionsModel := new(vpcv1.UpdateClusterNetworkOptions) + updateClusterNetworkOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkOptionsModel.ClusterNetworkPatch = clusterNetworkPatchModelAsPatch + updateClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetwork(updateClusterNetworkOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the AddVirtualNetworkInterfaceIPOptions model with no property values - addVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + // Construct a second instance of the UpdateClusterNetworkOptions model with no property values + updateClusterNetworkOptionsModelNew := new(vpcv1.UpdateClusterNetworkOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModelNew) + result, response, operationErr = vpcService.UpdateClusterNetwork(updateClusterNetworkOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -69111,7 +77290,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke AddVirtualNetworkInterfaceIP successfully`, func() { + It(`Invoke UpdateClusterNetwork successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -69120,14 +77299,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model - addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) - addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ClusterNetworkPatch model + clusterNetworkPatchModel := new(vpcv1.ClusterNetworkPatch) + clusterNetworkPatchModel.Name = core.StringPtr("my-cluster-network") + clusterNetworkPatchModelAsPatch, asPatchErr := clusterNetworkPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateClusterNetworkOptions model + updateClusterNetworkOptionsModel := new(vpcv1.UpdateClusterNetworkOptions) + updateClusterNetworkOptionsModel.ID = core.StringPtr("testString") + updateClusterNetworkOptionsModel.ClusterNetworkPatch = clusterNetworkPatchModelAsPatch + updateClusterNetworkOptionsModel.IfMatch = core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.UpdateClusterNetwork(updateClusterNetworkOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -69216,7 +77402,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListPublicGateways successfully with retries`, func() { @@ -69278,7 +77464,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListPublicGateways successfully`, func() { @@ -69378,7 +77564,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.PublicGatewayCollection) - nextObject := new(vpcv1.PublicGatewayCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -69395,7 +77581,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.PublicGatewayCollection) - nextObject := new(vpcv1.PublicGatewayCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -69419,9 +77605,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_gateway","status":"available","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_gateway","status":"available","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_gateway","status":"available","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip"},"href":"https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241","id":"dc5431ef-1fc6-4861-adc9-a59d077d1241","name":"my-public-gateway","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"public_gateway","status":"available","vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) } else { res.WriteHeader(400) } @@ -69516,7 +77702,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -69584,7 +77770,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreatePublicGateway successfully with retries`, func() { @@ -69607,7 +77793,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -69677,7 +77863,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreatePublicGateway successfully`, func() { @@ -69705,7 +77891,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -69746,7 +77932,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -69808,7 +77994,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -69978,7 +78164,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetPublicGateway successfully with retries`, func() { @@ -70035,7 +78221,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetPublicGateway successfully`, func() { @@ -70226,7 +78412,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdatePublicGateway successfully with retries`, func() { @@ -70306,7 +78492,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdatePublicGateway successfully`, func() { @@ -70518,7 +78704,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListFloatingIps successfully with retries`, func() { @@ -70590,7 +78776,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListFloatingIps successfully`, func() { @@ -70705,7 +78891,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.FloatingIPCollection) - nextObject := new(vpcv1.FloatingIPCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -70722,7 +78908,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.FloatingIPCollection) - nextObject := new(vpcv1.FloatingIPCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -70746,9 +78932,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"available","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"available","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"available","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","id":"r006-f45e0d90-12a8-4460-8210-290ff2ab75cd","name":"my-floating-ip","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"available","target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","primary_ip":{"address":"192.168.3.4","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"},"resource_type":"network_interface"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) } else { res.WriteHeader(400) } @@ -70915,7 +79101,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateFloatingIP successfully with retries`, func() { @@ -71002,7 +79188,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateFloatingIP successfully`, func() { @@ -71285,7 +79471,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetFloatingIP successfully with retries`, func() { @@ -71342,7 +79528,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetFloatingIP successfully`, func() { @@ -71470,7 +79656,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID model floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + floatingIPTargetPatchModel.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") // Construct an instance of the FloatingIPPatch model floatingIPPatchModel := new(vpcv1.FloatingIPPatch) @@ -71538,7 +79724,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateFloatingIP successfully with retries`, func() { @@ -71553,7 +79739,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID model floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + floatingIPTargetPatchModel.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") // Construct an instance of the FloatingIPPatch model floatingIPPatchModel := new(vpcv1.FloatingIPPatch) @@ -71623,7 +79809,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "id": "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateFloatingIP successfully`, func() { @@ -71643,7 +79829,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID model floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + floatingIPTargetPatchModel.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") // Construct an instance of the FloatingIPPatch model floatingIPPatchModel := new(vpcv1.FloatingIPPatch) @@ -71676,7 +79862,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID model floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + floatingIPTargetPatchModel.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") // Construct an instance of the FloatingIPPatch model floatingIPPatchModel := new(vpcv1.FloatingIPPatch) @@ -71730,7 +79916,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID model floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + floatingIPTargetPatchModel.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") // Construct an instance of the FloatingIPPatch model floatingIPPatchModel := new(vpcv1.FloatingIPPatch) @@ -71835,7 +80021,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?limit=20"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-1", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-1", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListNetworkAcls successfully with retries`, func() { @@ -71897,7 +80083,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?limit=20"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-1", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::network-acl:r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "r006-a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-1", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListNetworkAcls successfully`, func() { @@ -71997,7 +80183,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.NetworkACLCollection) - nextObject := new(vpcv1.NetworkACLCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -72014,7 +80200,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.NetworkACLCollection) - nextObject := new(vpcv1.NetworkACLCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -73168,7 +81354,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-1", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-1", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "total_count": 132}`) })) }) It(`Invoke ListNetworkACLRules successfully with retries`, func() { @@ -73231,7 +81417,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-1", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-1", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "total_count": 132}`) })) }) It(`Invoke ListNetworkACLRules successfully`, func() { @@ -73341,7 +81527,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.NetworkACLRuleCollection) - nextObject := new(vpcv1.NetworkACLRuleCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -73358,7 +81544,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.NetworkACLRuleCollection) - nextObject := new(vpcv1.NetworkACLRuleCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -74569,7 +82755,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}`) })) }) It(`Invoke ListSecurityGroups successfully with retries`, func() { @@ -74637,7 +82823,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}`) })) }) It(`Invoke ListSecurityGroups successfully`, func() { @@ -74746,7 +82932,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.SecurityGroupCollection) - nextObject := new(vpcv1.SecurityGroupCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -74763,7 +82949,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.SecurityGroupCollection) - nextObject := new(vpcv1.SecurityGroupCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -74787,9 +82973,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"rules":[{"direction":"inbound","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"remote":{"address":"192.168.3.4"},"protocol":"all"}],"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"rules":[{"direction":"inbound","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"remote":{"address":"192.168.3.4"},"protocol":"all"}],"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"rules":[{"direction":"inbound","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"remote":{"address":"192.168.3.4"},"protocol":"all"}],"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"rules":[{"direction":"inbound","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","id":"r006-6f2a6efe-21e2-401c-b237-620aa26ba16a","ip_version":"ipv4","local":{"address":"192.168.3.4"},"remote":{"address":"192.168.3.4"},"protocol":"all"}],"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -74965,7 +83151,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke CreateSecurityGroup successfully with retries`, func() { @@ -75065,7 +83251,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke CreateSecurityGroup successfully`, func() { @@ -75387,7 +83573,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke GetSecurityGroup successfully with retries`, func() { @@ -75444,7 +83630,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke GetSecurityGroup successfully`, func() { @@ -75635,7 +83821,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke UpdateSecurityGroup successfully with retries`, func() { @@ -75715,7 +83901,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke UpdateSecurityGroup successfully`, func() { @@ -75904,7 +84090,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}`) + fmt.Fprintf(res, "%s", `{"rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}`) })) }) It(`Invoke ListSecurityGroupRules successfully with retries`, func() { @@ -75961,7 +84147,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}`) + fmt.Fprintf(res, "%s", `{"rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}`) })) }) It(`Invoke ListSecurityGroupRules successfully`, func() { @@ -76162,7 +84348,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) })) }) It(`Invoke CreateSecurityGroupRule successfully with retries`, func() { @@ -76252,7 +84438,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) })) }) It(`Invoke CreateSecurityGroupRule successfully`, func() { @@ -76547,7 +84733,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) })) }) It(`Invoke GetSecurityGroupRule successfully with retries`, func() { @@ -76605,7 +84791,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) })) }) It(`Invoke GetSecurityGroupRule successfully`, func() { @@ -76738,9 +84924,9 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleLocalPatchModel := new(vpcv1.SecurityGroupRuleLocalPatchIP) securityGroupRuleLocalPatchModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the SecurityGroupRuleRemotePatchCIDR model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchCIDR) + securityGroupRuleRemotePatchModel.CIDRBlock = core.StringPtr("10.0.0.0/8") // Construct an instance of the SecurityGroupRulePatch model securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) @@ -76815,7 +85001,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) })) }) It(`Invoke UpdateSecurityGroupRule successfully with retries`, func() { @@ -76832,9 +85018,9 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleLocalPatchModel := new(vpcv1.SecurityGroupRuleLocalPatchIP) securityGroupRuleLocalPatchModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the SecurityGroupRuleRemotePatchCIDR model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchCIDR) + securityGroupRuleRemotePatchModel.CIDRBlock = core.StringPtr("10.0.0.0/8") // Construct an instance of the SecurityGroupRulePatch model securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) @@ -76911,7 +85097,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + fmt.Fprintf(res, "%s", `{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "r006-6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "local": {"address": "192.168.3.4"}, "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) })) }) It(`Invoke UpdateSecurityGroupRule successfully`, func() { @@ -76933,9 +85119,9 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleLocalPatchModel := new(vpcv1.SecurityGroupRuleLocalPatchIP) securityGroupRuleLocalPatchModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the SecurityGroupRuleRemotePatchCIDR model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchCIDR) + securityGroupRuleRemotePatchModel.CIDRBlock = core.StringPtr("10.0.0.0/8") // Construct an instance of the SecurityGroupRulePatch model securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) @@ -76977,9 +85163,9 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleLocalPatchModel := new(vpcv1.SecurityGroupRuleLocalPatchIP) securityGroupRuleLocalPatchModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the SecurityGroupRuleRemotePatchCIDR model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchCIDR) + securityGroupRuleRemotePatchModel.CIDRBlock = core.StringPtr("10.0.0.0/8") // Construct an instance of the SecurityGroupRulePatch model securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) @@ -77042,9 +85228,9 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleLocalPatchModel := new(vpcv1.SecurityGroupRuleLocalPatchIP) securityGroupRuleLocalPatchModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the SecurityGroupRuleRemotePatchCIDR model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchCIDR) + securityGroupRuleRemotePatchModel.CIDRBlock = core.StringPtr("10.0.0.0/8") // Construct an instance of the SecurityGroupRulePatch model securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) @@ -77154,7 +85340,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "total_count": 132}`) })) }) It(`Invoke ListSecurityGroupTargets successfully with retries`, func() { @@ -77215,7 +85401,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}], "total_count": 132}`) })) }) It(`Invoke ListSecurityGroupTargets successfully`, func() { @@ -77322,7 +85508,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.SecurityGroupTargetCollection) - nextObject := new(vpcv1.SecurityGroupTargetCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -77339,7 +85525,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.SecurityGroupTargetCollection) - nextObject := new(vpcv1.SecurityGroupTargetCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -77363,9 +85549,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","resource_type":"network_interface"}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","resource_type":"network_interface"}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"}]}`) } else { res.WriteHeader(400) } @@ -77568,7 +85754,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}`) + fmt.Fprintf(res, "%s", `{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}`) })) }) It(`Invoke GetSecurityGroupTarget successfully with retries`, func() { @@ -77626,7 +85812,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}`) + fmt.Fprintf(res, "%s", `{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}`) })) }) It(`Invoke GetSecurityGroupTarget successfully`, func() { @@ -77798,7 +85984,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}`) + fmt.Fprintf(res, "%s", `{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}`) })) }) It(`Invoke CreateSecurityGroupTargetBinding successfully with retries`, func() { @@ -77856,7 +86042,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}`) + fmt.Fprintf(res, "%s", `{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}`) })) }) It(`Invoke CreateSecurityGroupTargetBinding successfully`, func() { @@ -78032,7 +86218,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?limit=20"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListIkePolicies successfully with retries`, func() { @@ -78092,7 +86278,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?limit=20"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListIkePolicies successfully`, func() { @@ -78189,7 +86375,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.IkePolicyCollection) - nextObject := new(vpcv1.IkePolicyCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -78206,7 +86392,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.IkePolicyCollection) - nextObject := new(vpcv1.IkePolicyCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -79285,7 +87471,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/e98f46a3-1e4e-4195-b4e5-b8155192689d/connections?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/e98f46a3-1e4e-4195-b4e5-b8155192689d/connections?start=c6d339ad873241c4acc936dfcff3f6d2&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListIkePolicyConnections successfully with retries`, func() { @@ -79346,7 +87532,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/e98f46a3-1e4e-4195-b4e5-b8155192689d/connections?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/e98f46a3-1e4e-4195-b4e5-b8155192689d/connections?start=c6d339ad873241c4acc936dfcff3f6d2&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListIkePolicyConnections successfully`, func() { @@ -79453,7 +87639,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.IkePolicyConnectionCollection) - nextObject := new(vpcv1.IkePolicyConnectionCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -79470,7 +87656,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.IkePolicyConnectionCollection) - nextObject := new(vpcv1.IkePolicyConnectionCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -79628,7 +87814,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?limit=20"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListIpsecPolicies successfully with retries`, func() { @@ -79688,7 +87874,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?limit=20"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ipsec_policies": [{"authentication_algorithm": "disabled", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListIpsecPolicies successfully`, func() { @@ -79785,7 +87971,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.IPsecPolicyCollection) - nextObject := new(vpcv1.IPsecPolicyCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -79802,7 +87988,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.IPsecPolicyCollection) - nextObject := new(vpcv1.IPsecPolicyCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -80871,7 +89057,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/43c2f663-3960-4289-9253-f6eab23a6cd7/connections?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/43c2f663-3960-4289-9253-f6eab23a6cd7/connections?start=250337b8fa72455c962e-c23e5706d452&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListIpsecPolicyConnections successfully with retries`, func() { @@ -80932,7 +89118,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/43c2f663-3960-4289-9253-f6eab23a6cd7/connections?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/43c2f663-3960-4289-9253-f6eab23a6cd7/connections?start=250337b8fa72455c962e-c23e5706d452&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListIpsecPolicyConnections successfully`, func() { @@ -81039,7 +89225,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.IPsecPolicyConnectionCollection) - nextObject := new(vpcv1.IPsecPolicyConnectionCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -81056,7 +89242,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.IPsecPolicyConnectionCollection) - nextObject := new(vpcv1.IPsecPolicyConnectionCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -81223,7 +89409,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN's subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN's subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN's subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN's subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}]}`) })) }) It(`Invoke ListVPNGateways successfully with retries`, func() { @@ -81289,7 +89475,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN's subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN's subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN's subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "members": [{"health_reasons": [{"code": "cannot_reserve_ip_address", "message": "IP address exhaustion (release addresses on the VPN's subnet).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health"}], "health_state": "ok", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "private_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "public_ip": {"address": "192.168.3.4"}, "role": "active"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}]}`) })) }) It(`Invoke ListVPNGateways successfully`, func() { @@ -81395,7 +89581,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.VPNGatewayCollection) - nextObject := new(vpcv1.VPNGatewayCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -81412,7 +89598,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.VPNGatewayCollection) - nextObject := new(vpcv1.VPNGatewayCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -82500,7 +90686,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/a7d258d5-be1e-491d-83db-526d8d9a2ce9/connections?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/a7d258d5-be1e-491d-83db-526d8d9a2ce9/connections?start=b67efb2c-bd17-457d-be8e-7b46404062dc&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListVPNGatewayConnections successfully with retries`, func() { @@ -82563,7 +90749,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/a7d258d5-be1e-491d-83db-526d8d9a2ce9/connections?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/a7d258d5-be1e-491d-83db-526d8d9a2ce9/connections?start=b67efb2c-bd17-457d-be8e-7b46404062dc&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "establish_mode": "bidirectional", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "policy", "name": "my-vpn-connection", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}], "distribute_traffic": false, "local": {"ike_identities": [{"type": "fqdn", "value": "my-service.example.com"}]}, "peer": {"ike_identity": {"type": "fqdn", "value": "my-service.example.com"}, "type": "address", "address": "169.21.50.5"}, "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down", "status_reasons": [{"code": "cannot_authenticate_connection", "message": "Failed to authenticate a connection because of mismatched IKE ID and PSK.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-health#vpn-connection-health"}]}]}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListVPNGatewayConnections successfully`, func() { @@ -82673,7 +90859,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.VPNGatewayConnectionCollection) - nextObject := new(vpcv1.VPNGatewayConnectionCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -82690,7 +90876,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.VPNGatewayConnectionCollection) - nextObject := new(vpcv1.VPNGatewayConnectionCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -84985,7 +93171,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server's server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server's server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) })) }) It(`Invoke ListVPNServers successfully with retries`, func() { @@ -85051,7 +93237,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server's server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_reasons": [{"code": "cannot_access_server_certificate", "message": "Failed to get VPN server's server certificate from Secrets Manager.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-health"}], "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "tcp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) })) }) It(`Invoke ListVPNServers successfully`, func() { @@ -85157,7 +93343,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.VPNServerCollection) - nextObject := new(vpcv1.VPNServerCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -85174,7 +93360,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.VPNServerCollection) - nextObject := new(vpcv1.VPNServerCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -85316,7 +93502,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateVPNServerOptions model createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) @@ -85427,7 +93613,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateVPNServerOptions model createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) @@ -85545,7 +93731,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateVPNServerOptions model createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) @@ -85606,7 +93792,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateVPNServerOptions model createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) @@ -85688,7 +93874,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateVPNServerOptions model createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) @@ -86728,7 +94914,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "CommonName", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "Username"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "CommonName", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "Username"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListVPNServerClients successfully with retries`, func() { @@ -86791,7 +94977,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "CommonName", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "Username"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "CommonName", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "Username"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListVPNServerClients successfully`, func() { @@ -86901,7 +95087,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.VPNServerClientCollection) - nextObject := new(vpcv1.VPNServerClientCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -86918,7 +95104,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.VPNServerClientCollection) - nextObject := new(vpcv1.VPNServerClientCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -87462,7 +95648,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) })) }) It(`Invoke ListVPNServerRoutes successfully with retries`, func() { @@ -87525,7 +95711,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "health_reasons": [{"code": "internal_error", "message": "Internal error (contact IBM support).", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-server-route-health"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) })) }) It(`Invoke ListVPNServerRoutes successfully`, func() { @@ -87635,7 +95821,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.VPNServerRouteCollection) - nextObject := new(vpcv1.VPNServerRouteCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -87652,7 +95838,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.VPNServerRouteCollection) - nextObject := new(vpcv1.VPNServerRouteCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -88686,7 +96872,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}`) })) }) It(`Invoke ListLoadBalancerProfiles successfully with retries`, func() { @@ -88746,7 +96932,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "profiles": [{"access_modes": {"type": "enum", "values": ["private"]}, "availability": {"type": "fixed", "value": "region"}, "family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "instance_groups_supported": {"type": "fixed", "value": true}, "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "source_ip_session_persistence_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}`) })) }) It(`Invoke ListLoadBalancerProfiles successfully`, func() { @@ -88843,7 +97029,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.LoadBalancerProfileCollection) - nextObject := new(vpcv1.LoadBalancerProfileCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -88860,7 +97046,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.LoadBalancerProfileCollection) - nextObject := new(vpcv1.LoadBalancerProfileCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -89241,7 +97427,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers?limit=20"}, "limit": 20, "load_balancers": [{"access_mode": "private", "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "load_balancers": [{"access_mode": "private", "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListLoadBalancers successfully with retries`, func() { @@ -89301,7 +97487,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers?limit=20"}, "limit": 20, "load_balancers": [{"access_mode": "private", "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "load_balancers": [{"access_mode": "private", "availability": "region", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "dns": {"instance": {"crn": "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::"}, "zone": {"id": "d66662cc-aa23-4fe1-9987-858487a61f45"}}, "hostname": "6b88d615-us-south.lb.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "instance_groups_supported": true, "is_private_path": true, "is_public": true, "listeners": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "logging": {"datapath": {"active": true}}, "name": "my-load-balancer", "operating_status": "offline", "pools": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}], "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "profile": {"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "name": "network-fixed"}, "provisioning_status": "active", "public_ips": [{"address": "192.168.3.4"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "load_balancer", "route_mode": true, "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "source_ip_session_persistence_supported": true, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::subnet:0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "0717-7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}], "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListLoadBalancers successfully`, func() { @@ -89398,7 +97584,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.LoadBalancerCollection) - nextObject := new(vpcv1.LoadBalancerCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -89415,7 +97601,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.LoadBalancerCollection) - nextObject := new(vpcv1.LoadBalancerCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -89591,7 +97777,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -89624,7 +97810,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateLoadBalancerOptions model createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) @@ -89775,7 +97961,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -89808,7 +97994,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateLoadBalancerOptions model createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) @@ -89966,7 +98152,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -89999,7 +98185,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateLoadBalancerOptions model createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) @@ -90100,7 +98286,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -90133,7 +98319,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateLoadBalancerOptions model createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) @@ -90255,7 +98441,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -90288,7 +98474,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") // Construct an instance of the CreateLoadBalancerOptions model createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) @@ -95196,7 +103382,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"pools": [{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url": "anyValue", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}]}`) + fmt.Fprintf(res, "%s", `{"pools": [{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}]}`) })) }) It(`Invoke ListLoadBalancerPools successfully with retries`, func() { @@ -95253,7 +103439,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"pools": [{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url": "anyValue", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}]}`) + fmt.Fprintf(res, "%s", `{"pools": [{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}]}`) })) }) It(`Invoke ListLoadBalancerPools successfully`, func() { @@ -95390,7 +103576,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -95468,7 +103654,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url": "anyValue", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) + fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) })) }) It(`Invoke CreateLoadBalancerPool successfully with retries`, func() { @@ -95492,7 +103678,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -95572,7 +103758,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url": "anyValue", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) + fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) })) }) It(`Invoke CreateLoadBalancerPool successfully`, func() { @@ -95601,7 +103787,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -95653,7 +103839,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -95726,7 +103912,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -95909,7 +104095,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url": "anyValue", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) + fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) })) }) It(`Invoke GetLoadBalancerPool successfully with retries`, func() { @@ -95967,7 +104153,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url": "anyValue", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) + fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) })) }) It(`Invoke GetLoadBalancerPool successfully`, func() { @@ -96181,7 +104367,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url": "anyValue", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) + fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) })) }) It(`Invoke UpdateLoadBalancerPool successfully with retries`, func() { @@ -96281,7 +104467,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url": "anyValue", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) + fmt.Fprintf(res, "%s", `{"algorithm": "least_connections", "created_at": "2019-01-01T12:00:00.000Z", "health_monitor": {"delay": 5, "max_retries": 2, "port": 22, "timeout": 2, "type": "http", "url_path": "/"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "instance_group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group"}, "members": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "name": "my-load-balancer-pool", "protocol": "http", "provisioning_status": "active", "proxy_protocol": "disabled", "session_persistence": {"cookie_name": "my-cookie-name", "type": "app_cookie"}}`) })) }) It(`Invoke UpdateLoadBalancerPool successfully`, func() { @@ -96531,7 +104717,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) + fmt.Fprintf(res, "%s", `{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}`) })) }) It(`Invoke ListLoadBalancerPoolMembers successfully with retries`, func() { @@ -96589,7 +104775,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) + fmt.Fprintf(res, "%s", `{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}`) })) }) It(`Invoke ListLoadBalancerPoolMembers successfully`, func() { @@ -96720,7 +104906,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the CreateLoadBalancerPoolMemberOptions model createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) @@ -96784,7 +104970,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}`) })) }) It(`Invoke CreateLoadBalancerPoolMember successfully with retries`, func() { @@ -96799,7 +104985,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the CreateLoadBalancerPoolMemberOptions model createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) @@ -96865,7 +105051,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}`) })) }) It(`Invoke CreateLoadBalancerPoolMember successfully`, func() { @@ -96885,7 +105071,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the CreateLoadBalancerPoolMemberOptions model createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) @@ -96914,7 +105100,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the CreateLoadBalancerPoolMemberOptions model createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) @@ -96964,7 +105150,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the CreateLoadBalancerPoolMemberOptions model createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) @@ -97002,7 +105188,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"2024-06-23"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) @@ -97017,7 +105203,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -97084,8 +105270,8 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}`) })) }) It(`Invoke ReplaceLoadBalancerPoolMembers successfully with retries`, func() { @@ -97100,7 +105286,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -97169,8 +105355,8 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"members": [{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}]}`) })) }) It(`Invoke ReplaceLoadBalancerPoolMembers successfully`, func() { @@ -97190,7 +105376,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -97223,7 +105409,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -97263,7 +105449,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) It(`Invoke ReplaceLoadBalancerPoolMembers successfully`, func() { @@ -97277,7 +105463,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -97453,7 +105639,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}`) })) }) It(`Invoke GetLoadBalancerPoolMember successfully with retries`, func() { @@ -97512,7 +105698,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}`) })) }) It(`Invoke GetLoadBalancerPoolMember successfully`, func() { @@ -97646,7 +105832,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPatch model loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) @@ -97717,7 +105903,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}`) })) }) It(`Invoke UpdateLoadBalancerPoolMember successfully with retries`, func() { @@ -97732,7 +105918,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPatch model loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) @@ -97805,7 +105991,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a", "id": "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "health": "faulted", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "port": 80, "provisioning_status": "active", "target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "id": "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0", "name": "my-instance"}, "weight": 50}`) })) }) It(`Invoke UpdateLoadBalancerPoolMember successfully`, func() { @@ -97825,7 +106011,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPatch model loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) @@ -97861,7 +106047,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPatch model loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) @@ -97918,7 +106104,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") // Construct an instance of the LoadBalancerPoolMemberPatch model loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) @@ -98042,7 +106228,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoint_gateways": [{"allow_dns_resolution_binding": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"endpoint_gateways": [{"allow_dns_resolution_binding": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListEndpointGateways successfully with retries`, func() { @@ -98115,7 +106301,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoint_gateways": [{"allow_dns_resolution_binding": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"endpoint_gateways": [{"allow_dns_resolution_binding": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "lifecycle_reasons": [{"code": "dns_resolution_binding_pending", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "name": "my-endpoint-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "endpoint_gateway", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::security-group:r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "service_endpoint": "my-cloudant-instance.appdomain.cloud", "service_endpoints": ["my-cloudant-instance.appdomain.cloud"], "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "name": "my-private-path-service-gateway", "remote": {"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "private_path_service_gateway"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListEndpointGateways successfully`, func() { @@ -98233,7 +106419,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.EndpointGatewayCollection) - nextObject := new(vpcv1.EndpointGatewayCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -98250,7 +106436,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.EndpointGatewayCollection) - nextObject := new(vpcv1.EndpointGatewayCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -98816,7 +107002,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5/ips?start=90ac13871b604023ab8b827178518328&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListEndpointGatewayIps successfully with retries`, func() { @@ -98879,7 +107065,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5/ips?start=90ac13871b604023ab8b827178518328&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "provider", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::endpoint-gateway:r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListEndpointGatewayIps successfully`, func() { @@ -98989,7 +107175,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.ReservedIPCollectionEndpointGatewayContext) - nextObject := new(vpcv1.ReservedIPCollectionEndpointGatewayContextNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -99006,7 +107192,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.ReservedIPCollectionEndpointGatewayContext) - nextObject := new(vpcv1.ReservedIPCollectionEndpointGatewayContextNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -100317,7 +108503,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors?limit=20"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListFlowLogCollectors successfully with retries`, func() { @@ -100391,7 +108577,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors?limit=20"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "flow_log_collectors": [{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListFlowLogCollectors successfully`, func() { @@ -100509,7 +108695,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.FlowLogCollectorCollection) - nextObject := new(vpcv1.FlowLogCollectorCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -100526,7 +108712,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.FlowLogCollectorCollection) - nextObject := new(vpcv1.FlowLogCollectorCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -100550,9 +108736,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e","id":"0717-10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"flow_log_collectors":[{"active":true,"auto_delete":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689","href":"https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","lifecycle_state":"stable","name":"my-flow-log-collector","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"storage_bucket":{"name":"bucket-27200-lwx4cfvcue"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0717-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"r006-4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) } else { res.WriteHeader(400) } @@ -100655,7 +108841,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID model flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -100723,7 +108909,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke CreateFlowLogCollector successfully with retries`, func() { @@ -100742,7 +108928,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID model flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -100812,7 +108998,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke CreateFlowLogCollector successfully`, func() { @@ -100836,7 +109022,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID model flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -100873,7 +109059,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID model flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -100931,7 +109117,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID model flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -101101,7 +109287,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke GetFlowLogCollector successfully with retries`, func() { @@ -101158,7 +109344,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke GetFlowLogCollector successfully`, func() { @@ -101350,7 +109536,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke UpdateFlowLogCollector successfully with retries`, func() { @@ -101431,7 +109617,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "0717-10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::flow-log-collector:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/flow_log_collectors/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "lifecycle_state": "stable", "name": "my-flow-log-collector", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "storage_bucket": {"name": "bucket-27200-lwx4cfvcue"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0717-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke UpdateFlowLogCollector successfully`, func() { @@ -101631,7 +109817,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": false}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": false}], "total_count": 132}`) })) }) It(`Invoke ListPrivatePathServiceGateways successfully with retries`, func() { @@ -101693,7 +109879,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": false}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "private_path_service_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213", "default_access_policy": "deny", "endpoint_gateway_binding_auto_delete": true, "endpoint_gateway_binding_auto_delete_timeout": 1, "endpoint_gateway_count": 0, "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "lifecycle_state": "stable", "load_balancer": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "name": "my-load-balancer", "resource_type": "load_balancer"}, "name": "my-private-path-service-gateway", "published": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "private_path_service_gateway", "service_endpoints": ["*.example.com"], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zonal_affinity": false}], "total_count": 132}`) })) }) It(`Invoke ListPrivatePathServiceGateways successfully`, func() { @@ -101793,7 +109979,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.PrivatePathServiceGatewayCollection) - nextObject := new(vpcv1.PrivatePathServiceGatewayCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -101810,7 +109996,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.PrivatePathServiceGatewayCollection) - nextObject := new(vpcv1.PrivatePathServiceGatewayCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -102919,7 +111105,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/65f30e48-3074-4eb0-9ec4-51ce2ec968eb/account_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/65f30e48-3074-4eb0-9ec4-51ce2ec968eb/account_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListPrivatePathServiceGatewayAccountPolicies successfully with retries`, func() { @@ -102982,7 +111168,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/65f30e48-3074-4eb0-9ec4-51ce2ec968eb/account_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/65f30e48-3074-4eb0-9ec4-51ce2ec968eb/account_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"account_policies": [{"access_policy": "deny", "account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213/account_policies/dd455384-b019-4242-9453-45fe68b18e4c", "id": "r134-fb880975-db45-4459-8548-64e3995ac213", "resource_type": "private_path_service_gateway_account_policy"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListPrivatePathServiceGatewayAccountPolicies successfully`, func() { @@ -103092,7 +111278,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.PrivatePathServiceGatewayAccountPolicyCollection) - nextObject := new(vpcv1.PrivatePathServiceGatewayAccountPolicyCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -103109,7 +111295,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.PrivatePathServiceGatewayAccountPolicyCollection) - nextObject := new(vpcv1.PrivatePathServiceGatewayAccountPolicyCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -104165,7 +112351,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213/endpoint_gateway_bindings/r134-ce9dac18-dea0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/65f30e48-3074-4eb0-9ec4-51ce2ec968eb/endpoint_gateway_bindings?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/65f30e48-3074-4eb0-9ec4-51ce2ec968eb/endpoint_gateway_bindings?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213/endpoint_gateway_bindings/r134-ce9dac18-dea0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListPrivatePathServiceGatewayEndpointGatewayBindings successfully with retries`, func() { @@ -104230,7 +112416,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213/endpoint_gateway_bindings/r134-ce9dac18-dea0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/65f30e48-3074-4eb0-9ec4-51ce2ec968eb/endpoint_gateway_bindings?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/65f30e48-3074-4eb0-9ec4-51ce2ec968eb/endpoint_gateway_bindings?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"endpoint_gateway_bindings": [{"account": {"id": "bb1b52262f7441a586f49068482f1e60", "resource_type": "account"}, "created_at": "2019-01-01T12:00:00.000Z", "expiration_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/private_path_service_gateways/r134-fb880975-db45-4459-8548-64e3995ac213/endpoint_gateway_bindings/r134-ce9dac18-dea0-4392-841c-142d3300674f", "id": "r134-ce9dac18-dea0-4392-841c-142d3300674f", "lifecycle_state": "stable", "resource_type": "private_path_service_gateway_endpoint_gateway_binding", "status": "abandoned"}], "first": {"href": "Href"}, "limit": 20, "next": {"href": "Href"}, "total_count": 132}`) })) }) It(`Invoke ListPrivatePathServiceGatewayEndpointGatewayBindings successfully`, func() { @@ -104343,7 +112529,7 @@ var _ = Describe(`VpcV1`, func() { Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { responseObject := new(vpcv1.PrivatePathServiceGatewayEndpointGatewayBindingCollection) - nextObject := new(vpcv1.PrivatePathServiceGatewayEndpointGatewayBindingCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -104360,7 +112546,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { responseObject := new(vpcv1.PrivatePathServiceGatewayEndpointGatewayBindingCollection) - nextObject := new(vpcv1.PrivatePathServiceGatewayEndpointGatewayBindingCollectionNext) + nextObject := new(vpcv1.PageLink) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -105508,8 +113694,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -105579,8 +113765,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -105694,8 +113880,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -105786,6 +113972,181 @@ var _ = Describe(`VpcV1`, func() { Expect(createBareMetalServerOptionsModel.BareMetalServerPrototype).To(Equal(bareMetalServerPrototypeModel)) Expect(createBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateClusterNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-cluster-network-subnet-reserved-ip"))) + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + Expect(clusterNetworkSubnetIdentityModel).ToNot(BeNil()) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + Expect(clusterNetworkSubnetIdentityModel.ID).To(Equal(core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"))) + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel).ToNot(BeNil()) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name).To(Equal(core.StringPtr("my-cluster-network-interface"))) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP).To(Equal(clusterNetworkInterfacePrimaryIPPrototypeModel)) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet).To(Equal(clusterNetworkSubnetIdentityModel)) + + // Construct an instance of the InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID model + instanceClusterNetworkAttachmentBeforePrototypeModel := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) + Expect(instanceClusterNetworkAttachmentBeforePrototypeModel).ToNot(BeNil()) + instanceClusterNetworkAttachmentBeforePrototypeModel.ID = core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213") + Expect(instanceClusterNetworkAttachmentBeforePrototypeModel.ID).To(Equal(core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213"))) + + // Construct an instance of the CreateClusterNetworkAttachmentOptions model + instanceID := "testString" + var createClusterNetworkAttachmentOptionsClusterNetworkInterface vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf = nil + createClusterNetworkAttachmentOptionsModel := vpcService.NewCreateClusterNetworkAttachmentOptions(instanceID, createClusterNetworkAttachmentOptionsClusterNetworkInterface) + createClusterNetworkAttachmentOptionsModel.SetInstanceID("testString") + createClusterNetworkAttachmentOptionsModel.SetClusterNetworkInterface(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel) + createClusterNetworkAttachmentOptionsModel.SetBefore(instanceClusterNetworkAttachmentBeforePrototypeModel) + createClusterNetworkAttachmentOptionsModel.SetName("my-instance-network-attachment") + createClusterNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createClusterNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(createClusterNetworkAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createClusterNetworkAttachmentOptionsModel.ClusterNetworkInterface).To(Equal(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel)) + Expect(createClusterNetworkAttachmentOptionsModel.Before).To(Equal(instanceClusterNetworkAttachmentBeforePrototypeModel)) + Expect(createClusterNetworkAttachmentOptionsModel.Name).To(Equal(core.StringPtr("my-instance-network-attachment"))) + Expect(createClusterNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateClusterNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-cluster-network-subnet-reserved-ip"))) + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + Expect(clusterNetworkSubnetIdentityModel).ToNot(BeNil()) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + Expect(clusterNetworkSubnetIdentityModel.ID).To(Equal(core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"))) + + // Construct an instance of the CreateClusterNetworkInterfaceOptions model + clusterNetworkID := "testString" + createClusterNetworkInterfaceOptionsModel := vpcService.NewCreateClusterNetworkInterfaceOptions(clusterNetworkID) + createClusterNetworkInterfaceOptionsModel.SetClusterNetworkID("testString") + createClusterNetworkInterfaceOptionsModel.SetName("my-cluster-network-interface") + createClusterNetworkInterfaceOptionsModel.SetPrimaryIP(clusterNetworkInterfacePrimaryIPPrototypeModel) + createClusterNetworkInterfaceOptionsModel.SetSubnet(clusterNetworkSubnetIdentityModel) + createClusterNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createClusterNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(createClusterNetworkInterfaceOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(createClusterNetworkInterfaceOptionsModel.Name).To(Equal(core.StringPtr("my-cluster-network-interface"))) + Expect(createClusterNetworkInterfaceOptionsModel.PrimaryIP).To(Equal(clusterNetworkInterfacePrimaryIPPrototypeModel)) + Expect(createClusterNetworkInterfaceOptionsModel.Subnet).To(Equal(clusterNetworkSubnetIdentityModel)) + Expect(createClusterNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateClusterNetworkOptions successfully`, func() { + // Construct an instance of the ClusterNetworkProfileIdentityByName model + clusterNetworkProfileIdentityModel := new(vpcv1.ClusterNetworkProfileIdentityByName) + Expect(clusterNetworkProfileIdentityModel).ToNot(BeNil()) + clusterNetworkProfileIdentityModel.Name = core.StringPtr("h100") + Expect(clusterNetworkProfileIdentityModel.Name).To(Equal(core.StringPtr("h100"))) + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"))) + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + Expect(zoneIdentityModel).ToNot(BeNil()) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + Expect(zoneIdentityModel.Name).To(Equal(core.StringPtr("us-south-1"))) + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + Expect(resourceGroupIdentityModel).ToNot(BeNil()) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + Expect(resourceGroupIdentityModel.ID).To(Equal(core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345"))) + + // Construct an instance of the ClusterNetworkSubnetPrefixPrototype model + clusterNetworkSubnetPrefixPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrefixPrototype) + Expect(clusterNetworkSubnetPrefixPrototypeModel).ToNot(BeNil()) + clusterNetworkSubnetPrefixPrototypeModel.CIDR = core.StringPtr("10.0.0.0/24") + Expect(clusterNetworkSubnetPrefixPrototypeModel.CIDR).To(Equal(core.StringPtr("10.0.0.0/24"))) + + // Construct an instance of the CreateClusterNetworkOptions model + var createClusterNetworkOptionsProfile vpcv1.ClusterNetworkProfileIdentityIntf = nil + var createClusterNetworkOptionsVPC vpcv1.VPCIdentityIntf = nil + var createClusterNetworkOptionsZone vpcv1.ZoneIdentityIntf = nil + createClusterNetworkOptionsModel := vpcService.NewCreateClusterNetworkOptions(createClusterNetworkOptionsProfile, createClusterNetworkOptionsVPC, createClusterNetworkOptionsZone) + createClusterNetworkOptionsModel.SetProfile(clusterNetworkProfileIdentityModel) + createClusterNetworkOptionsModel.SetVPC(vpcIdentityModel) + createClusterNetworkOptionsModel.SetZone(zoneIdentityModel) + createClusterNetworkOptionsModel.SetName("my-cluster-network") + createClusterNetworkOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createClusterNetworkOptionsModel.SetSubnetPrefixes([]vpcv1.ClusterNetworkSubnetPrefixPrototype{*clusterNetworkSubnetPrefixPrototypeModel}) + createClusterNetworkOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createClusterNetworkOptionsModel).ToNot(BeNil()) + Expect(createClusterNetworkOptionsModel.Profile).To(Equal(clusterNetworkProfileIdentityModel)) + Expect(createClusterNetworkOptionsModel.VPC).To(Equal(vpcIdentityModel)) + Expect(createClusterNetworkOptionsModel.Zone).To(Equal(zoneIdentityModel)) + Expect(createClusterNetworkOptionsModel.Name).To(Equal(core.StringPtr("my-cluster-network"))) + Expect(createClusterNetworkOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createClusterNetworkOptionsModel.SubnetPrefixes).To(Equal([]vpcv1.ClusterNetworkSubnetPrefixPrototype{*clusterNetworkSubnetPrefixPrototypeModel})) + Expect(createClusterNetworkOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateClusterNetworkSubnetOptions successfully`, func() { + // Construct an instance of the ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype model + clusterNetworkSubnetPrototypeModel := new(vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) + Expect(clusterNetworkSubnetPrototypeModel).ToNot(BeNil()) + clusterNetworkSubnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + clusterNetworkSubnetPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet") + clusterNetworkSubnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + Expect(clusterNetworkSubnetPrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) + Expect(clusterNetworkSubnetPrototypeModel.Name).To(Equal(core.StringPtr("my-cluster-network-subnet"))) + Expect(clusterNetworkSubnetPrototypeModel.TotalIpv4AddressCount).To(Equal(core.Int64Ptr(int64(256)))) + + // Construct an instance of the CreateClusterNetworkSubnetOptions model + clusterNetworkID := "testString" + var clusterNetworkSubnetPrototype vpcv1.ClusterNetworkSubnetPrototypeIntf = nil + createClusterNetworkSubnetOptionsModel := vpcService.NewCreateClusterNetworkSubnetOptions(clusterNetworkID, clusterNetworkSubnetPrototype) + createClusterNetworkSubnetOptionsModel.SetClusterNetworkID("testString") + createClusterNetworkSubnetOptionsModel.SetClusterNetworkSubnetPrototype(clusterNetworkSubnetPrototypeModel) + createClusterNetworkSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createClusterNetworkSubnetOptionsModel).ToNot(BeNil()) + Expect(createClusterNetworkSubnetOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(createClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPrototype).To(Equal(clusterNetworkSubnetPrototypeModel)) + Expect(createClusterNetworkSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateClusterNetworkSubnetReservedIPOptions successfully`, func() { + // Construct an instance of the CreateClusterNetworkSubnetReservedIPOptions model + clusterNetworkID := "testString" + clusterNetworkSubnetID := "testString" + createClusterNetworkSubnetReservedIPOptionsModel := vpcService.NewCreateClusterNetworkSubnetReservedIPOptions(clusterNetworkID, clusterNetworkSubnetID) + createClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkID("testString") + createClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkSubnetID("testString") + createClusterNetworkSubnetReservedIPOptionsModel.SetAddress("192.168.3.4") + createClusterNetworkSubnetReservedIPOptionsModel.SetName("my-cluster-network-subnet-reserved-ip") + createClusterNetworkSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createClusterNetworkSubnetReservedIPOptionsModel).ToNot(BeNil()) + Expect(createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(createClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID).To(Equal(core.StringPtr("testString"))) + Expect(createClusterNetworkSubnetReservedIPOptionsModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + Expect(createClusterNetworkSubnetReservedIPOptionsModel.Name).To(Equal(core.StringPtr("my-cluster-network-subnet-reserved-ip"))) + Expect(createClusterNetworkSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateDedicatedHostGroupOptions successfully`, func() { // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) @@ -105834,8 +114195,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the DedicatedHostGroupIdentityByID model dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) Expect(dedicatedHostGroupIdentityModel).ToNot(BeNil()) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") - Expect(dedicatedHostGroupIdentityModel.ID).To(Equal(core.StringPtr("bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0"))) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + Expect(dedicatedHostGroupIdentityModel.ID).To(Equal(core.StringPtr("0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0"))) // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) @@ -105925,16 +114286,16 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID model floatingIPTargetPrototypeModel := new(vpcv1.FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) Expect(floatingIPTargetPrototypeModel).ToNot(BeNil()) - floatingIPTargetPrototypeModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") - Expect(floatingIPTargetPrototypeModel.ID).To(Equal(core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793"))) + floatingIPTargetPrototypeModel.ID = core.StringPtr("0717-fa41aecb-4f21-423d-8082-630bfba1e1d9") + Expect(floatingIPTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717-fa41aecb-4f21-423d-8082-630bfba1e1d9"))) // Construct an instance of the FloatingIPPrototypeFloatingIPByTarget model floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByTarget) Expect(floatingIPPrototypeModel).ToNot(BeNil()) - floatingIPPrototypeModel.Name = core.StringPtr("my-new-floating-ip") + floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel floatingIPPrototypeModel.Target = floatingIPTargetPrototypeModel - Expect(floatingIPPrototypeModel.Name).To(Equal(core.StringPtr("my-new-floating-ip"))) + Expect(floatingIPPrototypeModel.Name).To(Equal(core.StringPtr("my-floating-ip"))) Expect(floatingIPPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) Expect(floatingIPPrototypeModel.Target).To(Equal(floatingIPTargetPrototypeModel)) @@ -105957,8 +114318,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID model flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) Expect(flowLogCollectorTargetPrototypeModel).ToNot(BeNil()) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") - Expect(flowLogCollectorTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e"))) + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") + Expect(flowLogCollectorTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7"))) // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -106298,8 +114659,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -106365,8 +114726,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the CreateInstanceNetworkInterfaceOptions model instanceID := "testString" @@ -106395,8 +114756,44 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") Expect(instanceAvailabilityPolicyPrototypeModel.HostFailure).To(Equal(core.StringPtr("restart"))) - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-cluster-network-subnet-reserved-ip"))) + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + Expect(clusterNetworkSubnetIdentityModel).ToNot(BeNil()) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + Expect(clusterNetworkSubnetIdentityModel.ID).To(Equal(core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"))) + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel).ToNot(BeNil()) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name).To(Equal(core.StringPtr("my-cluster-network-interface"))) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP).To(Equal(clusterNetworkInterfacePrimaryIPPrototypeModel)) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet).To(Equal(clusterNetworkSubnetIdentityModel)) + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + Expect(instanceClusterNetworkAttachmentPrototypeInstanceContextModel).ToNot(BeNil()) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + Expect(instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface).To(Equal(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel)) + Expect(instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name).To(Equal(core.StringPtr("my-instance-network-attachment"))) + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) Expect(trustedProfileIdentityModel).ToNot(BeNil()) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") Expect(trustedProfileIdentityModel.ID).To(Equal(core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"))) @@ -106440,8 +114837,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) Expect(reservationIdentityModel).ToNot(BeNil()) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") - Expect(reservationIdentityModel.ID).To(Equal(core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63"))) + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") + Expect(reservationIdentityModel.ID).To(Equal(core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63"))) // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -106554,8 +114951,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -106599,6 +114996,7 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) Expect(instancePrototypeModel).ToNot(BeNil()) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instancePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instancePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -106619,6 +115017,7 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} instancePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel Expect(instancePrototypeModel.AvailabilityPolicy).To(Equal(instanceAvailabilityPolicyPrototypeModel)) + Expect(instancePrototypeModel.ClusterNetworkAttachments).To(Equal([]vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel})) Expect(instancePrototypeModel.ConfidentialComputeMode).To(Equal(core.StringPtr("disabled"))) Expect(instancePrototypeModel.DefaultTrustedProfile).To(Equal(instanceDefaultTrustedProfilePrototypeModel)) Expect(instancePrototypeModel.EnableSecureBoot).To(Equal(core.BoolPtr(true))) @@ -106655,8 +115054,44 @@ var _ = Describe(`VpcV1`, func() { instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") Expect(instanceAvailabilityPolicyPrototypeModel.HostFailure).To(Equal(core.StringPtr("restart"))) - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + // Construct an instance of the ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext model + clusterNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + clusterNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + clusterNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(clusterNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-cluster-network-subnet-reserved-ip"))) + + // Construct an instance of the ClusterNetworkSubnetIdentityByID model + clusterNetworkSubnetIdentityModel := new(vpcv1.ClusterNetworkSubnetIdentityByID) + Expect(clusterNetworkSubnetIdentityModel).ToNot(BeNil()) + clusterNetworkSubnetIdentityModel.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + Expect(clusterNetworkSubnetIdentityModel.ID).To(Equal(core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930"))) + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment model + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel).ToNot(BeNil()) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name = core.StringPtr("my-cluster-network-interface") + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP = clusterNetworkInterfacePrimaryIPPrototypeModel + instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet = clusterNetworkSubnetIdentityModel + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Name).To(Equal(core.StringPtr("my-cluster-network-interface"))) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.PrimaryIP).To(Equal(clusterNetworkInterfacePrimaryIPPrototypeModel)) + Expect(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel.Subnet).To(Equal(clusterNetworkSubnetIdentityModel)) + + // Construct an instance of the InstanceClusterNetworkAttachmentPrototypeInstanceContext model + instanceClusterNetworkAttachmentPrototypeInstanceContextModel := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + Expect(instanceClusterNetworkAttachmentPrototypeInstanceContextModel).ToNot(BeNil()) + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface = instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel + instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-instance-network-attachment") + Expect(instanceClusterNetworkAttachmentPrototypeInstanceContextModel.ClusterNetworkInterface).To(Equal(instanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceModel)) + Expect(instanceClusterNetworkAttachmentPrototypeInstanceContextModel.Name).To(Equal(core.StringPtr("my-instance-network-attachment"))) + + // Construct an instance of the TrustedProfileIdentityByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityByID) Expect(trustedProfileIdentityModel).ToNot(BeNil()) trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") Expect(trustedProfileIdentityModel.ID).To(Equal(core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"))) @@ -106700,8 +115135,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ReservationIdentityByID model reservationIdentityModel := new(vpcv1.ReservationIdentityByID) Expect(reservationIdentityModel).ToNot(BeNil()) - reservationIdentityModel.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") - Expect(reservationIdentityModel.ID).To(Equal(core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63"))) + reservationIdentityModel.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") + Expect(reservationIdentityModel.ID).To(Equal(core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63"))) // Construct an instance of the InstanceReservationAffinityPrototype model instanceReservationAffinityPrototypeModel := new(vpcv1.InstanceReservationAffinityPrototype) @@ -106814,8 +115249,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -106859,6 +115294,7 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) Expect(instanceTemplatePrototypeModel).ToNot(BeNil()) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instanceTemplatePrototypeModel.ClusterNetworkAttachments = []vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel} instanceTemplatePrototypeModel.ConfidentialComputeMode = core.StringPtr("disabled") instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.EnableSecureBoot = core.BoolPtr(true) @@ -106879,6 +115315,7 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} instanceTemplatePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel Expect(instanceTemplatePrototypeModel.AvailabilityPolicy).To(Equal(instanceAvailabilityPolicyPrototypeModel)) + Expect(instanceTemplatePrototypeModel.ClusterNetworkAttachments).To(Equal([]vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext{*instanceClusterNetworkAttachmentPrototypeInstanceContextModel})) Expect(instanceTemplatePrototypeModel.ConfidentialComputeMode).To(Equal(core.StringPtr("disabled"))) Expect(instanceTemplatePrototypeModel.DefaultTrustedProfile).To(Equal(instanceDefaultTrustedProfilePrototypeModel)) Expect(instanceTemplatePrototypeModel.EnableSecureBoot).To(Equal(core.BoolPtr(true))) @@ -107254,8 +115691,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a"))) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0"))) // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -107308,8 +115745,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the CreateLoadBalancerOptions model createLoadBalancerOptionsIsPublic := true @@ -107347,8 +115784,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a"))) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0"))) // Construct an instance of the CreateLoadBalancerPoolMemberOptions model loadBalancerID := "testString" @@ -107390,8 +115827,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a"))) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0"))) // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -107635,8 +116072,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) Expect(publicGatewayFloatingIPPrototypeModel).ToNot(BeNil()) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") - Expect(publicGatewayFloatingIPPrototypeModel.ID).To(Equal(core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689"))) + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") + Expect(publicGatewayFloatingIPPrototypeModel.ID).To(Equal(core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd"))) // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -107857,8 +116294,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -107942,8 +116379,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -108780,8 +117217,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the SecurityGroupIdentityByID model securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) Expect(securityGroupIdentityModel).ToNot(BeNil()) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + securityGroupIdentityModel.ID = core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("r006-be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) // Construct an instance of the CreateVPNServerOptions model var createVPNServerOptionsCertificate vpcv1.CertificateInstanceIdentityIntf = nil @@ -108897,6 +117334,66 @@ var _ = Describe(`VpcV1`, func() { Expect(deleteBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteClusterNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the DeleteClusterNetworkInterfaceOptions model + clusterNetworkID := "testString" + id := "testString" + deleteClusterNetworkInterfaceOptionsModel := vpcService.NewDeleteClusterNetworkInterfaceOptions(clusterNetworkID, id) + deleteClusterNetworkInterfaceOptionsModel.SetClusterNetworkID("testString") + deleteClusterNetworkInterfaceOptionsModel.SetID("testString") + deleteClusterNetworkInterfaceOptionsModel.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteClusterNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(deleteClusterNetworkInterfaceOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(deleteClusterNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteClusterNetworkInterfaceOptionsModel.IfMatch).To(Equal(core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(deleteClusterNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteClusterNetworkOptions successfully`, func() { + // Construct an instance of the DeleteClusterNetworkOptions model + id := "testString" + deleteClusterNetworkOptionsModel := vpcService.NewDeleteClusterNetworkOptions(id) + deleteClusterNetworkOptionsModel.SetID("testString") + deleteClusterNetworkOptionsModel.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteClusterNetworkOptionsModel).ToNot(BeNil()) + Expect(deleteClusterNetworkOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteClusterNetworkOptionsModel.IfMatch).To(Equal(core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(deleteClusterNetworkOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteClusterNetworkSubnetOptions successfully`, func() { + // Construct an instance of the DeleteClusterNetworkSubnetOptions model + clusterNetworkID := "testString" + id := "testString" + deleteClusterNetworkSubnetOptionsModel := vpcService.NewDeleteClusterNetworkSubnetOptions(clusterNetworkID, id) + deleteClusterNetworkSubnetOptionsModel.SetClusterNetworkID("testString") + deleteClusterNetworkSubnetOptionsModel.SetID("testString") + deleteClusterNetworkSubnetOptionsModel.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteClusterNetworkSubnetOptionsModel).ToNot(BeNil()) + Expect(deleteClusterNetworkSubnetOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(deleteClusterNetworkSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteClusterNetworkSubnetOptionsModel.IfMatch).To(Equal(core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(deleteClusterNetworkSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteClusterNetworkSubnetReservedIPOptions successfully`, func() { + // Construct an instance of the DeleteClusterNetworkSubnetReservedIPOptions model + clusterNetworkID := "testString" + clusterNetworkSubnetID := "testString" + id := "testString" + deleteClusterNetworkSubnetReservedIPOptionsModel := vpcService.NewDeleteClusterNetworkSubnetReservedIPOptions(clusterNetworkID, clusterNetworkSubnetID, id) + deleteClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkID("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkSubnetID("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.SetID("testString") + deleteClusterNetworkSubnetReservedIPOptionsModel.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + deleteClusterNetworkSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteClusterNetworkSubnetReservedIPOptionsModel).ToNot(BeNil()) + Expect(deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(deleteClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID).To(Equal(core.StringPtr("testString"))) + Expect(deleteClusterNetworkSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteClusterNetworkSubnetReservedIPOptionsModel.IfMatch).To(Equal(core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(deleteClusterNetworkSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteDedicatedHostGroupOptions successfully`, func() { // Construct an instance of the DeleteDedicatedHostGroupOptions model id := "testString" @@ -108980,6 +117477,19 @@ var _ = Describe(`VpcV1`, func() { Expect(deleteImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteInstanceClusterNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the DeleteInstanceClusterNetworkAttachmentOptions model + instanceID := "testString" + id := "testString" + deleteInstanceClusterNetworkAttachmentOptionsModel := vpcService.NewDeleteInstanceClusterNetworkAttachmentOptions(instanceID, id) + deleteInstanceClusterNetworkAttachmentOptionsModel.SetInstanceID("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.SetID("testString") + deleteInstanceClusterNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceClusterNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceClusterNetworkAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceClusterNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceClusterNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteInstanceGroupLoadBalancerOptions successfully`, func() { // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model instanceGroupID := "testString" @@ -109820,6 +118330,68 @@ var _ = Describe(`VpcV1`, func() { Expect(getBareMetalServerProfileOptionsModel.Name).To(Equal(core.StringPtr("bx2-metal-192x768"))) Expect(getBareMetalServerProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetClusterNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the GetClusterNetworkInterfaceOptions model + clusterNetworkID := "testString" + id := "testString" + getClusterNetworkInterfaceOptionsModel := vpcService.NewGetClusterNetworkInterfaceOptions(clusterNetworkID, id) + getClusterNetworkInterfaceOptionsModel.SetClusterNetworkID("testString") + getClusterNetworkInterfaceOptionsModel.SetID("testString") + getClusterNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getClusterNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(getClusterNetworkInterfaceOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(getClusterNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getClusterNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetClusterNetworkOptions successfully`, func() { + // Construct an instance of the GetClusterNetworkOptions model + id := "testString" + getClusterNetworkOptionsModel := vpcService.NewGetClusterNetworkOptions(id) + getClusterNetworkOptionsModel.SetID("testString") + getClusterNetworkOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getClusterNetworkOptionsModel).ToNot(BeNil()) + Expect(getClusterNetworkOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getClusterNetworkOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetClusterNetworkProfileOptions successfully`, func() { + // Construct an instance of the GetClusterNetworkProfileOptions model + name := "h100" + getClusterNetworkProfileOptionsModel := vpcService.NewGetClusterNetworkProfileOptions(name) + getClusterNetworkProfileOptionsModel.SetName("h100") + getClusterNetworkProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getClusterNetworkProfileOptionsModel).ToNot(BeNil()) + Expect(getClusterNetworkProfileOptionsModel.Name).To(Equal(core.StringPtr("h100"))) + Expect(getClusterNetworkProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetClusterNetworkSubnetOptions successfully`, func() { + // Construct an instance of the GetClusterNetworkSubnetOptions model + clusterNetworkID := "testString" + id := "testString" + getClusterNetworkSubnetOptionsModel := vpcService.NewGetClusterNetworkSubnetOptions(clusterNetworkID, id) + getClusterNetworkSubnetOptionsModel.SetClusterNetworkID("testString") + getClusterNetworkSubnetOptionsModel.SetID("testString") + getClusterNetworkSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getClusterNetworkSubnetOptionsModel).ToNot(BeNil()) + Expect(getClusterNetworkSubnetOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(getClusterNetworkSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getClusterNetworkSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetClusterNetworkSubnetReservedIPOptions successfully`, func() { + // Construct an instance of the GetClusterNetworkSubnetReservedIPOptions model + clusterNetworkID := "testString" + clusterNetworkSubnetID := "testString" + id := "testString" + getClusterNetworkSubnetReservedIPOptionsModel := vpcService.NewGetClusterNetworkSubnetReservedIPOptions(clusterNetworkID, clusterNetworkSubnetID, id) + getClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkID("testString") + getClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkSubnetID("testString") + getClusterNetworkSubnetReservedIPOptionsModel.SetID("testString") + getClusterNetworkSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getClusterNetworkSubnetReservedIPOptionsModel).ToNot(BeNil()) + Expect(getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(getClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID).To(Equal(core.StringPtr("testString"))) + Expect(getClusterNetworkSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getClusterNetworkSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetDedicatedHostDiskOptions successfully`, func() { // Construct an instance of the GetDedicatedHostDiskOptions model dedicatedHostID := "testString" @@ -109939,6 +118511,19 @@ var _ = Describe(`VpcV1`, func() { Expect(getImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetInstanceClusterNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the GetInstanceClusterNetworkAttachmentOptions model + instanceID := "testString" + id := "testString" + getInstanceClusterNetworkAttachmentOptionsModel := vpcService.NewGetInstanceClusterNetworkAttachmentOptions(instanceID, id) + getInstanceClusterNetworkAttachmentOptionsModel.SetInstanceID("testString") + getInstanceClusterNetworkAttachmentOptionsModel.SetID("testString") + getInstanceClusterNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceClusterNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(getInstanceClusterNetworkAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceClusterNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceClusterNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetInstanceDiskOptions successfully`, func() { // Construct an instance of the GetInstanceDiskOptions model instanceID := "testString" @@ -110803,6 +119388,11 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewInstanceClusterNetworkAttachmentPrototypeInstanceContext successfully`, func() { + var clusterNetworkInterface vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf = nil + _, err := vpcService.NewInstanceClusterNetworkAttachmentPrototypeInstanceContext(clusterNetworkInterface) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewInstanceDefaultTrustedProfilePrototype successfully`, func() { var target vpcv1.TrustedProfileIdentityIntf = nil _, err := vpcService.NewInstanceDefaultTrustedProfilePrototype(target) @@ -110970,6 +119560,97 @@ var _ = Describe(`VpcV1`, func() { Expect(listBareMetalServersOptionsModel.VPCName).To(Equal(core.StringPtr("my-vpc"))) Expect(listBareMetalServersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListClusterNetworkInterfacesOptions successfully`, func() { + // Construct an instance of the ListClusterNetworkInterfacesOptions model + clusterNetworkID := "testString" + listClusterNetworkInterfacesOptionsModel := vpcService.NewListClusterNetworkInterfacesOptions(clusterNetworkID) + listClusterNetworkInterfacesOptionsModel.SetClusterNetworkID("testString") + listClusterNetworkInterfacesOptionsModel.SetStart("testString") + listClusterNetworkInterfacesOptionsModel.SetLimit(int64(10)) + listClusterNetworkInterfacesOptionsModel.SetName("my-name") + listClusterNetworkInterfacesOptionsModel.SetSort("name") + listClusterNetworkInterfacesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listClusterNetworkInterfacesOptionsModel).ToNot(BeNil()) + Expect(listClusterNetworkInterfacesOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworkInterfacesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworkInterfacesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listClusterNetworkInterfacesOptionsModel.Name).To(Equal(core.StringPtr("my-name"))) + Expect(listClusterNetworkInterfacesOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listClusterNetworkInterfacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListClusterNetworkProfilesOptions successfully`, func() { + // Construct an instance of the ListClusterNetworkProfilesOptions model + listClusterNetworkProfilesOptionsModel := vpcService.NewListClusterNetworkProfilesOptions() + listClusterNetworkProfilesOptionsModel.SetStart("testString") + listClusterNetworkProfilesOptionsModel.SetLimit(int64(10)) + listClusterNetworkProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listClusterNetworkProfilesOptionsModel).ToNot(BeNil()) + Expect(listClusterNetworkProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworkProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listClusterNetworkProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListClusterNetworkSubnetReservedIpsOptions successfully`, func() { + // Construct an instance of the ListClusterNetworkSubnetReservedIpsOptions model + clusterNetworkID := "testString" + clusterNetworkSubnetID := "testString" + listClusterNetworkSubnetReservedIpsOptionsModel := vpcService.NewListClusterNetworkSubnetReservedIpsOptions(clusterNetworkID, clusterNetworkSubnetID) + listClusterNetworkSubnetReservedIpsOptionsModel.SetClusterNetworkID("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.SetClusterNetworkSubnetID("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.SetStart("testString") + listClusterNetworkSubnetReservedIpsOptionsModel.SetLimit(int64(10)) + listClusterNetworkSubnetReservedIpsOptionsModel.SetName("my-name") + listClusterNetworkSubnetReservedIpsOptionsModel.SetSort("name") + listClusterNetworkSubnetReservedIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listClusterNetworkSubnetReservedIpsOptionsModel).ToNot(BeNil()) + Expect(listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworkSubnetReservedIpsOptionsModel.ClusterNetworkSubnetID).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworkSubnetReservedIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworkSubnetReservedIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listClusterNetworkSubnetReservedIpsOptionsModel.Name).To(Equal(core.StringPtr("my-name"))) + Expect(listClusterNetworkSubnetReservedIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listClusterNetworkSubnetReservedIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListClusterNetworkSubnetsOptions successfully`, func() { + // Construct an instance of the ListClusterNetworkSubnetsOptions model + clusterNetworkID := "testString" + listClusterNetworkSubnetsOptionsModel := vpcService.NewListClusterNetworkSubnetsOptions(clusterNetworkID) + listClusterNetworkSubnetsOptionsModel.SetClusterNetworkID("testString") + listClusterNetworkSubnetsOptionsModel.SetStart("testString") + listClusterNetworkSubnetsOptionsModel.SetLimit(int64(10)) + listClusterNetworkSubnetsOptionsModel.SetName("my-name") + listClusterNetworkSubnetsOptionsModel.SetSort("name") + listClusterNetworkSubnetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listClusterNetworkSubnetsOptionsModel).ToNot(BeNil()) + Expect(listClusterNetworkSubnetsOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworkSubnetsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworkSubnetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listClusterNetworkSubnetsOptionsModel.Name).To(Equal(core.StringPtr("my-name"))) + Expect(listClusterNetworkSubnetsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listClusterNetworkSubnetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListClusterNetworksOptions successfully`, func() { + // Construct an instance of the ListClusterNetworksOptions model + listClusterNetworksOptionsModel := vpcService.NewListClusterNetworksOptions() + listClusterNetworksOptionsModel.SetStart("testString") + listClusterNetworksOptionsModel.SetLimit(int64(10)) + listClusterNetworksOptionsModel.SetResourceGroupID("testString") + listClusterNetworksOptionsModel.SetName("my-name") + listClusterNetworksOptionsModel.SetSort("name") + listClusterNetworksOptionsModel.SetVPCID("testString") + listClusterNetworksOptionsModel.SetVPCCRN("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b") + listClusterNetworksOptionsModel.SetVPCName("my-vpc") + listClusterNetworksOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listClusterNetworksOptionsModel).ToNot(BeNil()) + Expect(listClusterNetworksOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworksOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listClusterNetworksOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworksOptionsModel.Name).To(Equal(core.StringPtr("my-name"))) + Expect(listClusterNetworksOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listClusterNetworksOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listClusterNetworksOptionsModel.VPCCRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::vpc:r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"))) + Expect(listClusterNetworksOptionsModel.VPCName).To(Equal(core.StringPtr("my-vpc"))) + Expect(listClusterNetworksOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListDedicatedHostDisksOptions successfully`, func() { // Construct an instance of the ListDedicatedHostDisksOptions model dedicatedHostID := "testString" @@ -111174,6 +119855,20 @@ var _ = Describe(`VpcV1`, func() { Expect(listImagesOptionsModel.UserDataFormat).To(Equal([]string{"cloud_init"})) Expect(listImagesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListInstanceClusterNetworkAttachmentsOptions successfully`, func() { + // Construct an instance of the ListInstanceClusterNetworkAttachmentsOptions model + instanceID := "testString" + listInstanceClusterNetworkAttachmentsOptionsModel := vpcService.NewListInstanceClusterNetworkAttachmentsOptions(instanceID) + listInstanceClusterNetworkAttachmentsOptionsModel.SetInstanceID("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.SetStart("testString") + listInstanceClusterNetworkAttachmentsOptionsModel.SetLimit(int64(10)) + listInstanceClusterNetworkAttachmentsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceClusterNetworkAttachmentsOptionsModel).ToNot(BeNil()) + Expect(listInstanceClusterNetworkAttachmentsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceClusterNetworkAttachmentsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceClusterNetworkAttachmentsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listInstanceClusterNetworkAttachmentsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListInstanceDisksOptions successfully`, func() { // Construct an instance of the ListInstanceDisksOptions model instanceID := "testString" @@ -111338,6 +120033,9 @@ var _ = Describe(`VpcV1`, func() { listInstancesOptionsModel.SetLimit(int64(10)) listInstancesOptionsModel.SetResourceGroupID("testString") listInstancesOptionsModel.SetName("my-name") + listInstancesOptionsModel.SetClusterNetworkID("testString") + listInstancesOptionsModel.SetClusterNetworkCRN("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94") + listInstancesOptionsModel.SetClusterNetworkName("my-cluster-network") listInstancesOptionsModel.SetDedicatedHostID("testString") listInstancesOptionsModel.SetDedicatedHostCRN("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a") listInstancesOptionsModel.SetDedicatedHostName("my-dedicated-host") @@ -111356,6 +120054,9 @@ var _ = Describe(`VpcV1`, func() { Expect(listInstancesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstancesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listInstancesOptionsModel.Name).To(Equal(core.StringPtr("my-name"))) + Expect(listInstancesOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.ClusterNetworkCRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::cluster-network:r010-82b8c783-15d6-4a51-95bf-0b4649d3ef94"))) + Expect(listInstancesOptionsModel.ClusterNetworkName).To(Equal(core.StringPtr("my-cluster-network"))) Expect(listInstancesOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) Expect(listInstancesOptionsModel.DedicatedHostCRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a"))) Expect(listInstancesOptionsModel.DedicatedHostName).To(Equal(core.StringPtr("my-dedicated-host"))) @@ -111400,10 +120101,12 @@ var _ = Describe(`VpcV1`, func() { listKeysOptionsModel := vpcService.NewListKeysOptions() listKeysOptionsModel.SetStart("testString") listKeysOptionsModel.SetLimit(int64(10)) + listKeysOptionsModel.SetResourceGroupID("testString") listKeysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listKeysOptionsModel).ToNot(BeNil()) Expect(listKeysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) Expect(listKeysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listKeysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listKeysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListLoadBalancerListenerPoliciesOptions successfully`, func() { @@ -112413,8 +121116,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a"))) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0"))) // Construct an instance of the LoadBalancerPoolMemberPrototype model loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) @@ -112706,6 +121409,78 @@ var _ = Describe(`VpcV1`, func() { Expect(updateBareMetalServerOptionsModel.BareMetalServerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateClusterNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the UpdateClusterNetworkInterfaceOptions model + clusterNetworkID := "testString" + id := "testString" + clusterNetworkInterfacePatch := map[string]interface{}{"anyKey": "anyValue"} + updateClusterNetworkInterfaceOptionsModel := vpcService.NewUpdateClusterNetworkInterfaceOptions(clusterNetworkID, id, clusterNetworkInterfacePatch) + updateClusterNetworkInterfaceOptionsModel.SetClusterNetworkID("testString") + updateClusterNetworkInterfaceOptionsModel.SetID("testString") + updateClusterNetworkInterfaceOptionsModel.SetClusterNetworkInterfacePatch(map[string]interface{}{"anyKey": "anyValue"}) + updateClusterNetworkInterfaceOptionsModel.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateClusterNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(updateClusterNetworkInterfaceOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(updateClusterNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateClusterNetworkInterfaceOptionsModel.ClusterNetworkInterfacePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateClusterNetworkInterfaceOptionsModel.IfMatch).To(Equal(core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(updateClusterNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateClusterNetworkOptions successfully`, func() { + // Construct an instance of the UpdateClusterNetworkOptions model + id := "testString" + clusterNetworkPatch := map[string]interface{}{"anyKey": "anyValue"} + updateClusterNetworkOptionsModel := vpcService.NewUpdateClusterNetworkOptions(id, clusterNetworkPatch) + updateClusterNetworkOptionsModel.SetID("testString") + updateClusterNetworkOptionsModel.SetClusterNetworkPatch(map[string]interface{}{"anyKey": "anyValue"}) + updateClusterNetworkOptionsModel.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateClusterNetworkOptionsModel).ToNot(BeNil()) + Expect(updateClusterNetworkOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateClusterNetworkOptionsModel.ClusterNetworkPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateClusterNetworkOptionsModel.IfMatch).To(Equal(core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(updateClusterNetworkOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateClusterNetworkSubnetOptions successfully`, func() { + // Construct an instance of the UpdateClusterNetworkSubnetOptions model + clusterNetworkID := "testString" + id := "testString" + clusterNetworkSubnetPatch := map[string]interface{}{"anyKey": "anyValue"} + updateClusterNetworkSubnetOptionsModel := vpcService.NewUpdateClusterNetworkSubnetOptions(clusterNetworkID, id, clusterNetworkSubnetPatch) + updateClusterNetworkSubnetOptionsModel.SetClusterNetworkID("testString") + updateClusterNetworkSubnetOptionsModel.SetID("testString") + updateClusterNetworkSubnetOptionsModel.SetClusterNetworkSubnetPatch(map[string]interface{}{"anyKey": "anyValue"}) + updateClusterNetworkSubnetOptionsModel.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateClusterNetworkSubnetOptionsModel).ToNot(BeNil()) + Expect(updateClusterNetworkSubnetOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(updateClusterNetworkSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateClusterNetworkSubnetOptionsModel.ClusterNetworkSubnetPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateClusterNetworkSubnetOptionsModel.IfMatch).To(Equal(core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(updateClusterNetworkSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateClusterNetworkSubnetReservedIPOptions successfully`, func() { + // Construct an instance of the UpdateClusterNetworkSubnetReservedIPOptions model + clusterNetworkID := "testString" + clusterNetworkSubnetID := "testString" + id := "testString" + clusterNetworkSubnetReservedIPPatch := map[string]interface{}{"anyKey": "anyValue"} + updateClusterNetworkSubnetReservedIPOptionsModel := vpcService.NewUpdateClusterNetworkSubnetReservedIPOptions(clusterNetworkID, clusterNetworkSubnetID, id, clusterNetworkSubnetReservedIPPatch) + updateClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkID("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkSubnetID("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.SetID("testString") + updateClusterNetworkSubnetReservedIPOptionsModel.SetClusterNetworkSubnetReservedIPPatch(map[string]interface{}{"anyKey": "anyValue"}) + updateClusterNetworkSubnetReservedIPOptionsModel.SetIfMatch("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\"") + updateClusterNetworkSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateClusterNetworkSubnetReservedIPOptionsModel).ToNot(BeNil()) + Expect(updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkID).To(Equal(core.StringPtr("testString"))) + Expect(updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetID).To(Equal(core.StringPtr("testString"))) + Expect(updateClusterNetworkSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateClusterNetworkSubnetReservedIPOptionsModel.ClusterNetworkSubnetReservedIPPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateClusterNetworkSubnetReservedIPOptionsModel.IfMatch).To(Equal(core.StringPtr("W/\"96d225c4-56bd-43d9-98fc-d7148e5c5028\""))) + Expect(updateClusterNetworkSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateDedicatedHostDiskOptions successfully`, func() { // Construct an instance of the UpdateDedicatedHostDiskOptions model dedicatedHostID := "testString" @@ -112841,6 +121616,22 @@ var _ = Describe(`VpcV1`, func() { Expect(updateImageOptionsModel.ImagePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateInstanceClusterNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the UpdateInstanceClusterNetworkAttachmentOptions model + instanceID := "testString" + id := "testString" + instanceClusterNetworkAttachmentPatch := map[string]interface{}{"anyKey": "anyValue"} + updateInstanceClusterNetworkAttachmentOptionsModel := vpcService.NewUpdateInstanceClusterNetworkAttachmentOptions(instanceID, id, instanceClusterNetworkAttachmentPatch) + updateInstanceClusterNetworkAttachmentOptionsModel.SetInstanceID("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.SetID("testString") + updateInstanceClusterNetworkAttachmentOptionsModel.SetInstanceClusterNetworkAttachmentPatch(map[string]interface{}{"anyKey": "anyValue"}) + updateInstanceClusterNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceClusterNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(updateInstanceClusterNetworkAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceClusterNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceClusterNetworkAttachmentOptionsModel.InstanceClusterNetworkAttachmentPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateInstanceClusterNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateInstanceDiskOptions successfully`, func() { // Construct an instance of the UpdateInstanceDiskOptions model instanceID := "testString" @@ -113711,6 +122502,42 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewClusterNetworkProfileIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100" + _model, err := vpcService.NewClusterNetworkProfileIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewClusterNetworkProfileIdentityByName successfully`, func() { + name := "h100" + _model, err := vpcService.NewClusterNetworkProfileIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewClusterNetworkSubnetIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930" + _model, err := vpcService.NewClusterNetworkSubnetIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewClusterNetworkSubnetIdentityByID successfully`, func() { + id := "0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930" + _model, err := vpcService.NewClusterNetworkSubnetIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype successfully`, func() { + ipv4CIDRBlock := "10.0.0.0/24" + _model, err := vpcService.NewClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype(ipv4CIDRBlock) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype successfully`, func() { + totalIpv4AddressCount := int64(256) + _model, err := vpcService.NewClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype(totalIpv4AddressCount) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewDnsInstanceIdentityByCRN successfully`, func() { crn := "crn:v1:bluemix:public:dns-svcs:global:a/bb1b52262f7441a586f49068482f1e60:f761b566-030a-4696-8649-cc9d09889e88::" _model, err := vpcService.NewDnsInstanceIdentityByCRN(crn) @@ -113724,19 +122551,19 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewDedicatedHostGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewDedicatedHostGroupIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewDedicatedHostGroupIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewDedicatedHostGroupIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewDedicatedHostGroupIdentityByID successfully`, func() { - id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + id := "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewDedicatedHostGroupIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -113846,6 +122673,18 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(version) Expect(err).ToNot(BeNil()) }) + It(`Invoke NewInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213" + _model, err := vpcService.NewInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID successfully`, func() { + id := "0717-fb880975-db45-4459-8548-64e3995ac213" + _model, err := vpcService.NewInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype successfully`, func() { metricType := "cpu" metricValue := int64(38) @@ -113920,7 +122759,7 @@ var _ = Describe(`VpcV1`, func() { Expect(err).ToNot(BeNil()) }) It(`Invoke NewKeyIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45" + crn := "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45" _model, err := vpcService.NewKeyIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -113932,13 +122771,13 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewKeyIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45" + href := "https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45" _model, err := vpcService.NewKeyIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewKeyIdentityByID successfully`, func() { - id := "82679077-ac3b-4c10-be16-63e9c21f0f45" + id := "r006-82679077-ac3b-4c10-be16-63e9c21f0f45" _model, err := vpcService.NewKeyIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -114190,19 +123029,19 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewReservationIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63" _model, err := vpcService.NewReservationIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewReservationIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63" + href := "https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63" _model, err := vpcService.NewReservationIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewReservationIdentityByID successfully`, func() { - id := "7187-ba49df72-37b8-43ac-98da-f8e029de0e63" + id := "0717-ba49df72-37b8-43ac-98da-f8e029de0e63" _model, err := vpcService.NewReservationIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -114289,7 +123128,7 @@ var _ = Describe(`VpcV1`, func() { }) It(`Invoke NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp successfully`, func() { direction := "inbound" - protocol := "udp" + protocol := "tcp" _model, err := vpcService.NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction, protocol) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -114319,13 +123158,13 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewShareIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58" _model, err := vpcService.NewShareIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewShareIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58" + href := "https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58" _model, err := vpcService.NewShareIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -114461,15 +123300,15 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewTrustedProfileIdentityTrustedProfileByCRN successfully`, func() { + It(`Invoke NewTrustedProfileIdentityByCRN successfully`, func() { crn := "crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5" - _model, err := vpcService.NewTrustedProfileIdentityTrustedProfileByCRN(crn) + _model, err := vpcService.NewTrustedProfileIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewTrustedProfileIdentityTrustedProfileByID successfully`, func() { + It(`Invoke NewTrustedProfileIdentityByID successfully`, func() { id := "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5" - _model, err := vpcService.NewTrustedProfileIdentityTrustedProfileByID(id) + _model, err := vpcService.NewTrustedProfileIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) @@ -114722,23 +123561,35 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { - id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + id := "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + _model, err := vpcService.NewClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID successfully`, func() { + id := "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + _model, err := vpcService.NewClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewEndpointGatewayReservedIPReservedIPIdentityByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/0717-bea6a632-5e13-42a4-b4b8-31dc877abfe4/reserved_ips/0717-6d353a0f-aeb1-4ae1-832e-1110d10981bb" _model, err := vpcService.NewEndpointGatewayReservedIPReservedIPIdentityByHref(href) @@ -114752,109 +123603,109 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" + href := "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6" _model, err := vpcService.NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID successfully`, func() { - id := "10c02d81-0ecb-4dc5-897d-28392913b81e" + id := "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6" _model, err := vpcService.NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e" + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7" _model, err := vpcService.NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { - id := "0717-10c02d81-0ecb-4dc5-897d-28392913b81e" + id := "0717-d54eb633-98ea-459d-aa00-6a8e780175a7" _model, err := vpcService.NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { - id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + id := "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" + href := "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6" _model, err := vpcService.NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID successfully`, func() { - id := "10c02d81-0ecb-4dc5-897d-28392913b81e" + id := "0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6" _model, err := vpcService.NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e" + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7" _model, err := vpcService.NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { - id := "0717-10c02d81-0ecb-4dc5-897d-28392913b81e" + id := "0717-d54eb633-98ea-459d-aa00-6a8e780175a7" _model, err := vpcService.NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { - id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + id := "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a" + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID successfully`, func() { - id := "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a" + id := "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7" + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -114866,13 +123717,13 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e" + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { - id := "0717-10c02d81-0ecb-4dc5-897d-28392913b81e" + id := "0717-d54eb633-98ea-459d-aa00-6a8e780175a7" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -114914,23 +123765,35 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { - id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + id := "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb" + _model, err := vpcService.NewInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID successfully`, func() { + id := "0717-ffc092f7-5d02-4b93-ab69-26860529b9fb" + _model, err := vpcService.NewInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727" _model, err := vpcService.NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href) @@ -114944,37 +123807,37 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { - id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + id := "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID successfully`, func() { - id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + id := "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -114998,19 +123861,19 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID successfully`, func() { - id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + id := "0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -115034,19 +123897,19 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871" + crn := "crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871" _model, err := vpcService.NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871" + href := "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871" _model, err := vpcService.NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID successfully`, func() { - id := "r018-418fe842-a3e9-47b9-a938-1aa5bd632871" + id := "r006-418fe842-a3e9-47b9-a938-1aa5bd632871" _model, err := vpcService.NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -115174,19 +124037,19 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0" _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a" + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0" _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID successfully`, func() { - id := "0717_1e09281b-f177-46f2-b1f1-bc152b2e391a" + id := "0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0" _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -115210,19 +124073,19 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd" _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689" + href := "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd" _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID successfully`, func() { - id := "39300233-9995-4806-89a5-3c1b6eb88689" + id := "r006-f45e0d90-12a8-4460-8210-290ff2ab75cd" _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -115246,19 +124109,19 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { - id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + id := "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -115348,19 +124211,19 @@ var _ = Describe(`VpcV1`, func() { Expect(err).To(BeNil()) }) It(`Invoke NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + crn := "crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { - id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + id := "0717-54eb57ee-86f2-4796-90bb-d7874e0831ef" _model, err := vpcService.NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -115780,9 +124643,9 @@ var _ = Describe(`VpcV1`, func() { model.ResourceGroup = nil model.SecurityGroups = nil model.Subnet = nil - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -116087,6 +124950,179 @@ var _ = Describe(`VpcV1`, func() { Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) + It(`Invoke UnmarshalClusterNetworkInterfacePatch successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkInterfacePatch) + model.AutoDelete = core.BoolPtr(false) + model.Name = core.StringPtr("my-cluster-network-interface") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkInterfacePatch + err = vpcv1.UnmarshalClusterNetworkInterfacePatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkInterfacePrimaryIPPrototype successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototype) + model.ID = core.StringPtr("6d353a0f-aeb1-4ae1-832e-1110d10981bb") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb") + model.Address = core.StringPtr("192.168.3.4") + model.AutoDelete = core.BoolPtr(false) + model.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkInterfacePrimaryIPPrototype + err = vpcv1.UnmarshalClusterNetworkInterfacePrimaryIPPrototype(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkPatch successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkPatch) + model.Name = core.StringPtr("my-cluster-network") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkPatch + err = vpcv1.UnmarshalClusterNetworkPatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkProfileIdentity successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkProfileIdentity) + model.Name = core.StringPtr("h100") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkProfileIdentity + err = vpcv1.UnmarshalClusterNetworkProfileIdentity(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetIdentity successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetIdentity) + model.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetIdentity + err = vpcv1.UnmarshalClusterNetworkSubnetIdentity(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetPatch successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetPatch) + model.Name = core.StringPtr("my-cluster-network-subnet") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetPatch + err = vpcv1.UnmarshalClusterNetworkSubnetPatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetPrefixPrototype successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetPrefixPrototype) + model.CIDR = core.StringPtr("10.0.0.0/24") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetPrefixPrototype + err = vpcv1.UnmarshalClusterNetworkSubnetPrefixPrototype(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetPrototype successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetPrototype) + model.IPVersion = core.StringPtr("ipv4") + model.Name = core.StringPtr("my-cluster-network-subnet") + model.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + model.Ipv4CIDRBlock = core.StringPtr("10.0.0.0/24") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetPrototype + err = vpcv1.UnmarshalClusterNetworkSubnetPrototype(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetReservedIPPatch successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetReservedIPPatch) + model.AutoDelete = core.BoolPtr(false) + model.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetReservedIPPatch + err = vpcv1.UnmarshalClusterNetworkSubnetReservedIPPatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) It(`Invoke UnmarshalDnsInstanceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DnsInstanceIdentity) @@ -116145,7 +125181,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalDedicatedHostDiskPatch successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DedicatedHostDiskPatch) - model.Name = core.StringPtr("my-disk-updated") + model.Name = core.StringPtr("my-dedicated-host-disk-updated") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -116163,9 +125199,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalDedicatedHostGroupIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DedicatedHostGroupIdentity) - model.ID = core.StringPtr("bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.ID = core.StringPtr("0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -116183,7 +125219,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalDedicatedHostGroupPatch successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DedicatedHostGroupPatch) - model.Name = core.StringPtr("my-host-group") + model.Name = core.StringPtr("my-dedicated-host-group") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -116201,7 +125237,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DedicatedHostGroupPrototypeDedicatedHostByZoneContext) - model.Name = core.StringPtr("my-host-group") + model.Name = core.StringPtr("my-dedicated-host-group") model.ResourceGroup = nil b, err := json.Marshal(model) @@ -116341,7 +125377,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalEndpointGatewayTargetPrototype successfully`, func() { // Construct an instance of the model. model := new(vpcv1.EndpointGatewayTargetPrototype) - model.ResourceType = core.StringPtr("provider_cloud_service") + model.ResourceType = core.StringPtr("private_path_service_gateway") model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::private-path-service-gateway:r134-fb880975-db45-4459-8548-64e3995ac213") model.Name = core.StringPtr("ibm-ntp-server") @@ -116401,9 +125437,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatch successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatch) - model.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -116421,9 +125457,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototype successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototype) - model.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -116460,9 +125496,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototype successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototype) - model.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + model.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -116698,6 +125734,85 @@ var _ = Describe(`VpcV1`, func() { Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentBeforePrototype successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototype) + model.ID = core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentBeforePrototype + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentBeforePrototype(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentPatch successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentPatch) + model.Name = core.StringPtr("my-instance-network-attachment-updated") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentPatch + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentPatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface) + model.AutoDelete = core.BoolPtr(false) + model.Name = core.StringPtr("my-cluster-network-interface") + model.PrimaryIP = nil + model.Subnet = nil + model.ID = core.StringPtr("0717-ffc092f7-5d02-4b93-ab69-26860529b9fb") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext) + model.ClusterNetworkInterface = nil + model.Name = core.StringPtr("my-instance-network-attachment") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentPrototypeInstanceContext + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) It(`Invoke UnmarshalInstanceDefaultTrustedProfilePrototype successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceDefaultTrustedProfilePrototype) @@ -117078,9 +126193,9 @@ var _ = Describe(`VpcV1`, func() { model.ResourceGroup = nil model.SecurityGroups = nil model.Subnet = nil - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -117203,6 +126318,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototype) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -117320,6 +126436,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototype) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -117360,9 +126477,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalKeyIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.KeyIdentity) - model.ID = core.StringPtr("82679077-ac3b-4c10-be16-63e9c21f0f45") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45") + model.ID = core.StringPtr("r006-82679077-ac3b-4c10-be16-63e9c21f0f45") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45") model.Fingerprint = core.StringPtr("SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY") b, err := json.Marshal(model) @@ -117953,9 +127070,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalLoadBalancerPoolMemberTargetPrototype successfully`, func() { // Construct an instance of the model. model := new(vpcv1.LoadBalancerPoolMemberTargetPrototype) - model.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a") + model.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") model.Address = core.StringPtr("192.168.3.4") b, err := json.Marshal(model) @@ -118404,9 +127521,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalPublicGatewayFloatingIPPrototype successfully`, func() { // Construct an instance of the model. model := new(vpcv1.PublicGatewayFloatingIPPrototype) - model.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689") + model.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") model.Address = core.StringPtr("203.0.113.1") model.Name = core.StringPtr("my-floating-ip") model.ResourceGroup = nil @@ -118558,9 +127675,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalReservationIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ReservationIdentity) - model.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + model.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -118959,10 +128076,11 @@ var _ = Describe(`VpcV1`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result interface{} + var result *vpcv1.SecurityGroupRulePrototype err = vpcv1.UnmarshalSecurityGroupRulePrototype(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) }) It(`Invoke UnmarshalSecurityGroupRuleRemotePatch successfully`, func() { // Construct an instance of the model. @@ -119012,8 +128130,8 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.ShareIdentity) model.ID = core.StringPtr("0fe9e5d8-0a4d-4818-96ec-e99708644a58") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -119099,9 +128217,9 @@ var _ = Describe(`VpcV1`, func() { model.ResourceGroup = nil model.SecurityGroups = nil model.Subnet = nil - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -120463,9 +129581,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -120846,6 +129964,157 @@ var _ = Describe(`VpcV1`, func() { Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) + It(`Invoke UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext) + model.ID = core.StringPtr("6d353a0f-aeb1-4ae1-832e-1110d10981bb") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext + err = vpcv1.UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext) + model.Address = core.StringPtr("192.168.3.4") + model.AutoDelete = core.BoolPtr(false) + model.Name = core.StringPtr("my-cluster-network-subnet-reserved-ip") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext + err = vpcv1.UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkProfileIdentityByHref successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkProfileIdentityByHref) + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_network/profiles/h100") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkProfileIdentityByHref + err = vpcv1.UnmarshalClusterNetworkProfileIdentityByHref(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkProfileIdentityByName successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkProfileIdentityByName) + model.Name = core.StringPtr("h100") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkProfileIdentityByName + err = vpcv1.UnmarshalClusterNetworkProfileIdentityByName(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetIdentityByHref successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetIdentityByHref) + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetIdentityByHref + err = vpcv1.UnmarshalClusterNetworkSubnetIdentityByHref(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetIdentityByID successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetIdentityByID) + model.ID = core.StringPtr("0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetIdentityByID + err = vpcv1.UnmarshalClusterNetworkSubnetIdentityByID(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype) + model.IPVersion = core.StringPtr("ipv4") + model.Name = core.StringPtr("my-cluster-network-subnet") + model.Ipv4CIDRBlock = core.StringPtr("10.0.0.0/24") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype + err = vpcv1.UnmarshalClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype) + model.IPVersion = core.StringPtr("ipv4") + model.Name = core.StringPtr("my-cluster-network-subnet") + model.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype + err = vpcv1.UnmarshalClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) It(`Invoke UnmarshalDnsInstanceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DnsInstanceIdentityByCRN) @@ -120885,7 +130154,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalDedicatedHostGroupIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DedicatedHostGroupIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -120903,7 +130172,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalDedicatedHostGroupIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DedicatedHostGroupIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -120921,7 +130190,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalDedicatedHostGroupIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.DedicatedHostGroupIdentityByID) - model.ID = core.StringPtr("bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.ID = core.StringPtr("0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121175,8 +130444,8 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) - model.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121194,8 +130463,8 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentity) - model.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121213,9 +130482,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121233,8 +130502,8 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) - model.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121252,8 +130521,8 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeNetworkInterfaceIdentity) - model.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121271,9 +130540,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121291,9 +130560,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeInstanceIdentity) - model.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a") + model.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121312,7 +130581,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) model.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121330,8 +130599,8 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) - model.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121389,9 +130658,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121546,6 +130815,82 @@ var _ = Describe(`VpcV1`, func() { Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref) + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/cluster_network_attachments/0717-fb880975-db45-4459-8548-64e3995ac213") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID) + model.ID = core.StringPtr("0717-fb880975-db45-4459-8548-64e3995ac213") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity) + model.ID = core.StringPtr("0717-ffc092f7-5d02-4b93-ab69-26860529b9fb") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment) + model.AutoDelete = core.BoolPtr(false) + model.Name = core.StringPtr("my-cluster-network-interface") + model.PrimaryIP = nil + model.Subnet = nil + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) It(`Invoke UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototype) @@ -121657,9 +131002,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121740,9 +131085,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPatchDedicatedHostGroupIdentity) - model.ID = core.StringPtr("bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.ID = core.StringPtr("0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121780,9 +131125,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) - model.ID = core.StringPtr("bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.ID = core.StringPtr("0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121820,9 +131165,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPrototypePlacementGroupIdentity) - model.ID = core.StringPtr("r018-418fe842-a3e9-47b9-a938-1aa5bd632871") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871") + model.ID = core.StringPtr("r006-418fe842-a3e9-47b9-a938-1aa5bd632871") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -121877,6 +131222,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByCatalogOffering) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -121916,6 +131262,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByImage) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -121955,6 +131302,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceBySourceSnapshot) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -121993,6 +131341,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceBySourceTemplate) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -122034,6 +131383,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByVolume) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -122126,6 +131476,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -122165,6 +131516,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImage) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -122204,6 +131556,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -122242,6 +131595,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -122282,7 +131636,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalKeyIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.KeyIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:82679077-ac3b-4c10-be16-63e9c21f0f45") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::key:r006-82679077-ac3b-4c10-be16-63e9c21f0f45") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -122318,7 +131672,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalKeyIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.KeyIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/keys/82679077-ac3b-4c10-be16-63e9c21f0f45") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/keys/r006-82679077-ac3b-4c10-be16-63e9c21f0f45") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -122336,7 +131690,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalKeyIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.KeyIdentityByID) - model.ID = core.StringPtr("82679077-ac3b-4c10-be16-63e9c21f0f45") + model.ID = core.StringPtr("r006-82679077-ac3b-4c10-be16-63e9c21f0f45") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -122668,9 +132022,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) - model.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a") + model.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -123126,9 +132480,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentity) - model.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689") + model.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") model.Address = core.StringPtr("203.0.113.1") b, err := json.Marshal(model) @@ -123256,7 +132610,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalReservationIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ReservationIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::reservation:0717-ba49df72-37b8-43ac-98da-f8e029de0e63") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -123274,7 +132628,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalReservationIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ReservationIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/reservations/7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/reservations/0717-ba49df72-37b8-43ac-98da-f8e029de0e63") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -123292,7 +132646,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalReservationIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ReservationIdentityByID) - model.ID = core.StringPtr("7187-ba49df72-37b8-43ac-98da-f8e029de0e63") + model.ID = core.StringPtr("0717-ba49df72-37b8-43ac-98da-f8e029de0e63") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -123330,9 +132684,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -123673,7 +133027,7 @@ var _ = Describe(`VpcV1`, func() { model.Local = nil model.PortMax = core.Int64Ptr(int64(22)) model.PortMin = core.Int64Ptr(int64(22)) - model.Protocol = core.StringPtr("udp") + model.Protocol = core.StringPtr("tcp") model.Remote = nil b, err := json.Marshal(model) @@ -123804,7 +133158,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalShareIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ShareIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::share:r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -123822,7 +133176,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalShareIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ShareIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/shares/r006-0fe9e5d8-0a4d-4818-96ec-e99708644a58") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -123898,9 +133252,9 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -124340,9 +133694,9 @@ var _ = Describe(`VpcV1`, func() { Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalTrustedProfileIdentityTrustedProfileByCRN successfully`, func() { + It(`Invoke UnmarshalTrustedProfileIdentityByCRN successfully`, func() { // Construct an instance of the model. - model := new(vpcv1.TrustedProfileIdentityTrustedProfileByCRN) + model := new(vpcv1.TrustedProfileIdentityByCRN) model.CRN = core.StringPtr("crn:v1:bluemix:public:iam-identity::a/aa2432b1fa4d4ace891e9b80fc104e34::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") b, err := json.Marshal(model) @@ -124352,15 +133706,15 @@ var _ = Describe(`VpcV1`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *vpcv1.TrustedProfileIdentityTrustedProfileByCRN - err = vpcv1.UnmarshalTrustedProfileIdentityTrustedProfileByCRN(raw, &result) + var result *vpcv1.TrustedProfileIdentityByCRN + err = vpcv1.UnmarshalTrustedProfileIdentityByCRN(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalTrustedProfileIdentityTrustedProfileByID successfully`, func() { + It(`Invoke UnmarshalTrustedProfileIdentityByID successfully`, func() { // Construct an instance of the model. - model := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + model := new(vpcv1.TrustedProfileIdentityByID) model.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") b, err := json.Marshal(model) @@ -124370,8 +133724,8 @@ var _ = Describe(`VpcV1`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *vpcv1.TrustedProfileIdentityTrustedProfileByID - err = vpcv1.UnmarshalTrustedProfileIdentityTrustedProfileByID(raw, &result) + var result *vpcv1.TrustedProfileIdentityByID + err = vpcv1.UnmarshalTrustedProfileIdentityByID(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) @@ -125331,7 +134685,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125349,7 +134703,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125367,7 +134721,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125382,6 +134736,42 @@ var _ = Describe(`VpcV1`, func() { Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) + It(`Invoke UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref) + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/subnets/0717-7931845c-65c4-4b0a-80cd-7d9c1a6d7930/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref + err = vpcv1.UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByHref(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID) + model.ID = core.StringPtr("6d353a0f-aeb1-4ae1-832e-1110d10981bb") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID + err = vpcv1.UnmarshalClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContextByID(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) It(`Invoke UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityByHref) @@ -125421,7 +134811,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125439,7 +134829,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125457,7 +134847,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125475,7 +134865,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125493,7 +134883,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125511,7 +134901,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125529,7 +134919,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125547,7 +134937,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/0717-aad10fd7-8a02-4f3e-97f3-b18bd82cf304/network_interfaces/0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125565,7 +134955,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-da8c43ec-b6ca-4bd2-871e-72e288c66ee6") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125583,7 +134973,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125601,7 +134991,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125619,7 +135009,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125637,7 +135027,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125655,7 +135045,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125673,7 +135063,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125691,7 +135081,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125709,7 +135099,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) - model.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + model.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125727,7 +135117,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_attachments/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125763,7 +135153,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0/network_interfaces/0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125781,7 +135171,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0717-10c02d81-0ecb-4dc5-897d-28392913b81e") + model.ID = core.StringPtr("0717-d54eb633-98ea-459d-aa00-6a8e780175a7") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125907,7 +135297,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125925,7 +135315,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125943,7 +135333,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -125958,6 +135348,42 @@ var _ = Describe(`VpcV1`, func() { Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref) + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/cluster_networks/0717-da0df18c-7598-4633-a648-fdaac28a5573/interfaces/0717-ffc092f7-5d02-4b93-ab69-26860529b9fb") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByHref(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID successfully`, func() { + // Construct an instance of the model. + model := new(vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID) + model.ID = core.StringPtr("0717-ffc092f7-5d02-4b93-ab69-26860529b9fb") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID + err = vpcv1.UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentityClusterNetworkInterfaceIdentityByID(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) It(`Invoke UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) @@ -126043,7 +135469,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126061,7 +135487,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126079,7 +135505,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126097,7 +135523,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126115,7 +135541,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126133,7 +135559,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - model.ID = core.StringPtr("bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.ID = core.StringPtr("0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126205,7 +135631,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::dedicated-host-group:0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126223,7 +135649,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126241,7 +135667,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - model.ID = core.StringPtr("bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") + model.ID = core.StringPtr("0717-bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126313,7 +135739,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/aa2432b1fa4d4ace891e9b80fc104e34::placement-group:r006-418fe842-a3e9-47b9-a938-1aa5bd632871") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126331,7 +135757,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r006-418fe842-a3e9-47b9-a938-1aa5bd632871") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126349,7 +135775,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) - model.ID = core.StringPtr("r018-418fe842-a3e9-47b9-a938-1aa5bd632871") + model.ID = core.StringPtr("r006-418fe842-a3e9-47b9-a938-1aa5bd632871") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126368,6 +135794,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126405,6 +135832,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126442,6 +135870,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126479,6 +135908,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126516,6 +135946,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126552,6 +135983,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126588,6 +136020,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126624,6 +136057,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126660,6 +136094,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126697,6 +136132,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126734,6 +136170,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126771,6 +136208,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126808,6 +136246,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126844,6 +136283,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the model. model := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) model.AvailabilityPolicy = nil + model.ClusterNetworkAttachments = nil model.ConfidentialComputeMode = core.StringPtr("disabled") model.DefaultTrustedProfile = nil model.EnableSecureBoot = core.BoolPtr(true) @@ -126951,7 +136391,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::instance:0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126969,7 +136409,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_1e09281b-f177-46fb-b1f1-bc152b2e391a") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/instances/0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -126987,7 +136427,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - model.ID = core.StringPtr("0717_1e09281b-f177-46f2-b1f1-bc152b2e391a") + model.ID = core.StringPtr("0717_e21b7391-2ca2-4ab5-84a8-b92157a633b0") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127059,7 +136499,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::floating-ip:r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127077,7 +136517,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/floating_ips/r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127095,7 +136535,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - model.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + model.ID = core.StringPtr("r006-f45e0d90-12a8-4460-8210-290ff2ab75cd") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127167,7 +136607,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127185,7 +136625,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127203,7 +136643,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127473,7 +136913,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.CRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/aa2432b1fa4d4ace891e9b80fc104e34::virtual-network-interface:0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127491,7 +136931,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.Href = core.StringPtr("https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -127509,7 +136949,7 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { // Construct an instance of the model. model := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - model.ID = core.StringPtr("0767-fa41aecb-4f21-423d-8082-630bfba1e1d9") + model.ID = core.StringPtr("0717-54eb57ee-86f2-4796-90bb-d7874e0831ef") b, err := json.Marshal(model) Expect(err).To(BeNil())